1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Additional user admin perms, cron-categories added.

This commit is contained in:
CaMer0n 2011-05-11 22:25:02 +00:00
parent 414acedafc
commit b33f03d327
9 changed files with 95 additions and 35 deletions

View File

@ -574,7 +574,7 @@ $array_functions = array(
21 => array(e_ADMIN.'admin_log.php', ADLAN_155, ADLAN_156, 'S', 4, E_16_ADMINLOG, E_32_ADMINLOG),
22 => array(e_ADMIN.'theme.php', ADLAN_140, ADLAN_141, '1', 5, E_16_THEMEMANAGER, E_32_THEMEMANAGER),
23 => array(e_ADMIN.'upload.php', ADLAN_72, ADLAN_73, 'V', 3, E_16_UPLOADS, E_32_UPLOADS),
24 => array(e_ADMIN.'users.php', ADLAN_36, ADLAN_37, '4|U1|U2|U3', 2, E_16_USER, E_32_USER),
24 => array(e_ADMIN.'users.php', ADLAN_36, ADLAN_37, '4|U0|U1|U2|U3', 2, E_16_USER, E_32_USER),
25 => array(e_ADMIN.'userclass2.php', ADLAN_38, ADLAN_39, '4', 2, E_16_USERCLASS, E_32_USERCLASS),
26 => array(e_ADMIN.'language.php', ADLAN_132, ADLAN_133, '0', 1, E_16_LANGUAGE, E_32_LANGUAGE),
27 => array(e_ADMIN.'mailout.php', ADLAN_136, ADLAN_137, 'W', 2, E_16_MAIL, E_32_MAIL),

View File

@ -66,13 +66,17 @@ class cron_admin_ui extends e_admin_ui
protected $pluginName = 'core';
protected $table = "cron";
protected $pid = "cron_id";
protected $listOrder = 'cron_category';
protected $perPage = 10;
protected $batchDelete = TRUE;
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'cron_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
'cron_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> FALSE, 'nolist'=>TRUE),
'cron_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data' => 'str', 'width'=>'auto','readonly' => 1, 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
'cron_name' => array('title'=> "Name", 'type' => 'text', 'width' => 'auto', 'readonly' => 1),
'cron_description' => array('title'=> "Description", 'type' => 'text', 'width' => '35%', 'readonly' => 1),
'cron_function' => array('title'=> "Function", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'readonly' => 1),
@ -121,9 +125,24 @@ class cron_admin_ui extends e_admin_ui
// Import Core and Plugin e_cron data
$cronDefaults['_system'] = array(
0 => array('name' => 'Test Email', 'function' => 'sendEmail', 'description' => 'Send a test email to '.$pref['siteadminemail'].'<br />Recommended to test the scheduling system.'),
1 => array('name' => 'Mail Queue', 'function' => 'procEmailQueue', 'description' => 'Process mail queue'),
2 => array('name' => 'Mail Bounce Check', 'function' => 'procEmailBounce', 'description' => 'Check for bounced emails', 'available' => vartrue($pref['mail_bounce_auto'])),
0 => array(
'name' => 'Test Email',
'function' => 'sendEmail',
'category' => 'mail',
'description' => 'Send a test email to '.$pref['siteadminemail'].'<br />Recommended to test the scheduling system.'
),
1 => array(
'name' => 'Mail Queue',
'category' => 'mail',
'function' => 'procEmailQueue',
'description' => 'Process mail queue'),
2 => array(
'name' => 'Mail Bounce Check',
'category' => 'mail',
'function' => 'procEmailBounce',
'description' => 'Check for bounced emails',
// 'available' => vartrue($pref['mail_bounce_auto'])
),
);
if(!$_GET['action'])
@ -155,6 +174,7 @@ class cron_admin_ui extends e_admin_ui
$insert = array(
'cron_id' => 0,
'cron_name' => $val['name'],
'cron_category' => $val['category'],
'cron_description' => $val['description'],
'cron_function' => $class."::".$val['function'],
'cron_tab' => '* * * * *',
@ -403,7 +423,14 @@ class cron_admin_form_ui extends e_admin_form_ui
);
var $cronCategories = array(
'backup' => "Backup",
'content' => ADLAN_CL_3,
'log' => "Logging",
'mail' => ADLAN_136,
'notify' => ADLAN_149,
'user' => LAN_USER,
);
/**
* Render cron_tab field
@ -442,6 +469,29 @@ class cron_admin_form_ui extends e_admin_form_ui
}
}
function cron_category($curVal,$mode)
{
if($mode == 'read')
{
return isset($this->cronCategories[$curVal]) ? $this->cronCategories[$curVal] : "";
}
if($mode == 'write')
{
return isset($this->cronCategories[$curVal]) ? $this->cronCategories[$curVal] : "";
}
if($mode == 'filter')
{
return $this->cronCategories;
}
if($mode == 'batch')
{
return;
}
}
// Override the default Options field.
function options($field, $value, $attributes, $id)
{

View File

@ -156,6 +156,7 @@ CREATE TABLE core_media_cat (
CREATE TABLE cron (
cron_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
cron_name VARCHAR(50) NOT NULL,
cron_category VARCHAR(20) NOT NULL,
cron_description VARCHAR(255) NOT NULL,
cron_function VARCHAR(50) NOT NULL,
cron_tab VARCHAR(255) NOT NULL,

View File

@ -15,7 +15,7 @@
*/
require_once ('../class2.php');
if (!getperms('4|U1|U2|U3') )
if (!getperms('4|U0|U1|U2|U3') )
{
header('location:'.$e107->url->getUrl('core:core','main','action=index'));
exit;
@ -599,7 +599,7 @@ switch ($action)
break;
case "create" :
if(getperms(('4|U1')))
if(getperms(('4|U1|U0')))
{
$userMethods->deleteExpired(); // Remove time-expired users
$user->user_add($user_data);
@ -616,7 +616,7 @@ switch ($action)
break;
default :
if(getperms('4|U1'))
if(getperms('4|U1|U0'))
{
$user->show_existing_users($action,$sub_action,$id,$from,$amount);
}
@ -643,10 +643,10 @@ class users
$var = array();
$var ['main']['text'] = LAN_USER_LIST;
$var ['main']['link'] = e_ADMIN.'users.php';
$var ['main']['perm'] = '4|U1';
$var ['main']['perm'] = '4|U0|U1';
$var ['create']['text'] = LAN_USER_QUICKADD;
$var ['create']['link'] = e_ADMIN.'users.php?create';
$var ['create']['perm'] = '4|U1';
$var ['create']['perm'] = '4|U0|U1';
$var ['prune']['text'] = LAN_USER_PRUNE;
$var ['prune']['link'] = e_ADMIN.'users.php?prune';// Will be moved to "Schedule tasks"
$var ['prune']['perm'] = '4';
@ -734,10 +734,12 @@ class users
}
$this->fields['options'] = array('title' => LAN_OPTIONS,'width' => '10%',"thclass" => "center last",'forced' => true);
if(!getperms('4'))
if(!getperms('4|U0')) // Quick Add User Access Only.
{
unset($this->fields['checkboxes']);
unset($this->fields['options']);
$this->fieldpref = array('user_name','user_loginname','user_login','user_email','user_class','user_ban','user_admin');
}
// print_a($this->fields);
}
@ -1219,7 +1221,7 @@ class users
$qry = $this->get_search_query();
$this->fieldpref = array_unique($this->fieldpref);
$text = "<div>".$this->show_search_filter();
if ($user_total = $sql->db_Select_gen($qry))
@ -1364,7 +1366,7 @@ class users
function show_batch_options()
{
if(!getperms('4'))
if(!getperms('4|U0'))
{
return;
}

View File

@ -841,42 +841,43 @@ class e_userperms
"C" => array(ADMSLAN_64,E_16_CACHE, E_32_CACHE), // Clear the system cache
"F" => array(ADMSLAN_31,E_16_EMOTE, E_32_EMOTE), // Emoticons
"G" => array(ADMSLAN_32,E_16_FRONT, E_32_FRONT), // Front-Page Configuration
"T" => array(ADMSLAN_34,E_16_META, E_32_META), // Meta tags
"T" => array(ADMSLAN_34,E_16_META, E_32_META), // Meta tags
"1" => array(ADMSLAN_19,E_16_PREFS, E_32_PREFS), // Alter Site Preferences
"X" => array(ADMSLAN_66,E_16_SEARCH, E_32_SEARCH), // Search
"X" => array(ADMSLAN_66,E_16_SEARCH, E_32_SEARCH), // Search
"I" => array(ADMSLAN_40,E_16_LINKS, E_32_LINKS), // Post SiteLinks
"8" => array(ADMSLAN_27,E_16_LINKS, E_32_LINKS), // Oversee SiteLink Categories
"L" => array(ADMSLAN_43,E_16_EURL, E_32_EURL), // Configure URLs
"L" => array(ADMSLAN_43,E_16_EURL, E_32_EURL), // Configure URLs
// Users
"3" => array(ADMSLAN_21,E_16_ADMIN, E_32_ADMIN), // Modify Admin perms
"4" => array(ADMSLAN_22,E_16_USER, E_32_USER), // Moderate users/bans etc
"U1" => array(LAN_USER_QUICKADD,E_16_USER, E_32_USER), // USRLAN_72, // "User: Quick Add User",
"U2" => array(LAN_USER_OPTIONS,E_16_USER, E_32_USER),
"U3" => array(LAN_USER_RANKS,E_16_USER, E_32_USER),
"W" => array(ADMSLAN_65,E_16_MAIL, E_32_MAIL), // Configure mail settings and mailout
"4" => array(LAN_USER_MANAGEALL,E_16_USER, E_32_USER), // Manage all user access and settings etc
"U0" => array(ADMSLAN_22,E_16_USER, E_32_USER), // moderate users/bans but not userclasses or extended fields,
"U1" => array(LAN_USER_QUICKADD,E_16_USER, E_32_USER), // "User: Quick Add User",
"U2" => array(LAN_USER_OPTIONS,E_16_USER, E_32_USER), // Manage only user-options
"U3" => array(LAN_USER_RANKS,E_16_USER, E_32_USER), // Manage only user-ranks
"W" => array(ADMSLAN_65,E_16_MAIL, E_32_MAIL), // Configure mail settings and mailout
// Content
"5" => array(ADMSLAN_23,E_16_CUST, E_32_CUST), // create/edit custom PAGES
"J" => array(ADMSLAN_41,E_16_CUST, E_32_CUST), // create/edit custom MENUS
"H" => array(ADMSLAN_39,E_16_NEWS, E_32_NEWS), // Post News
"N" => array(ADMSLAN_47,E_16_NEWS, E_32_NEWS), // Moderate submitted news
// Content
"5" => array(ADMSLAN_23,E_16_CUST, E_32_CUST), // create/edit custom PAGES
"J" => array(ADMSLAN_41,E_16_CUST, E_32_CUST), // create/edit custom MENUS
"H" => array(ADMSLAN_39,E_16_NEWS, E_32_NEWS), // Post News
"N" => array(ADMSLAN_47,E_16_NEWS, E_32_NEWS), // Moderate submitted news
"V" => array(ADMSLAN_35,E_16_UPLOADS, E_32_UPLOADS), // Configure public file uploads
"M" => array(ADMSLAN_46,E_16_WELCOME, E_32_WELCOME), // Welcome Messages
// Tools
"Y" => array(ADMSLAN_67,E_16_INSPECT, E_32_INSPECT), // File inspector
"9" => array(ADMSLAN_28,E_16_MAINTAIN, E_32_MAINTAIN), // Take Down site for Maintenance
"O" => array(ADMSLAN_68,E_16_NOTIFY, E_32_NOTIFY), // Notify
"U" => array(ADMSLAN_45,E_16_CRON, E_32_CRON), // Schedule Tasks
"O" => array(ADMSLAN_68,E_16_NOTIFY, E_32_NOTIFY), // Notify
"U" => array(ADMSLAN_45,E_16_CRON, E_32_CRON), // Schedule Tasks
"S" => array(ADMSLAN_33,E_16_ADMINLOG, E_32_ADMINLOG), // System Logging
// Manage
"B" => array(ADMSLAN_37,E_16_COMMENT, E_32_COMMENT), // Moderate Comments
"6" => array(ADMSLAN_25,E_16_FILE, E_32_FILE), // File-Manager - Upload /manage files -
"A" => array(ADMSLAN_36,E_16_IMAGES, E_32_IMAGES), // Media-Manager and Image Settings
"6" => array(ADMSLAN_25,E_16_FILE, E_32_FILE), // File-Manager - Upload /manage files -
"A" => array(ADMSLAN_36,E_16_IMAGES, E_32_IMAGES), // Media-Manager and Image Settings
"2" => array(ADMSLAN_20,E_16_MENUS, E_32_MENUS), // Alter Menus

View File

@ -352,6 +352,7 @@ define('LAN_UI_PREF_LABEL', 'Settings');
define('LAN_UI_DELETE_LABEL', 'Confirm Delete');
define('LAN_UI_DELETE_WARNING', 'You are about to delete <strong>%1$d</strong> records. Please confirm to continue.');
define("LAN_USER_MANAGEALL", "Manage all user access and settings");
define("LAN_USER_LIST", "User List");
define("LAN_USER_QUICKADD","Quick Add User");
define("LAN_USER_PRUNE", "Prune Users");

View File

@ -33,12 +33,14 @@ class gsitemap_cron // include plugin-folder in the name.
$cron[] = array(
'name' => "Update Records",
'function' => "myfunction",
'category' => '',
'description' => "Dummy example."
);
$cron[] = array(
'name' => "Test Email",
'function' => "sendEmail",
'category' => 'mail', // mail, user, content, notify, backup
'description' => "Sends a test email to ".$pref['siteadminemail']
);

View File

@ -58,7 +58,12 @@ class pm_cron // include plugin-folder in the name.
public function config()
{
$cron = array();
$cron[] = array('name' => LAN_EC_PM_04, 'function' => 'processPM', 'description' => LAN_EC_PM_05);
$cron[] = array(
'name' => LAN_EC_PM_04,
'category' => 'log',
'function' => 'processPM',
'description' => LAN_EC_PM_05
);
return $cron;
}

View File

@ -103,7 +103,6 @@ class plugin_release_admin_ui extends e_admin_ui
/**
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
* Write your list query without any Order or Limit.
* NOTE: $tableJoin array is recommended join method
*
* @var string [optional]
*/
@ -111,7 +110,6 @@ class plugin_release_admin_ui extends e_admin_ui
//
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
// NOT NEEDED ANYMORE!!!
//protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
// required - if no custom model is set in init() (primary id)