1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02: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), 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), 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), 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), 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), 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), 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 $pluginName = 'core';
protected $table = "cron"; protected $table = "cron";
protected $pid = "cron_id"; protected $pid = "cron_id";
protected $listOrder = 'cron_category';
protected $perPage = 10; protected $perPage = 10;
protected $batchDelete = TRUE; protected $batchDelete = TRUE;
protected $fields = array( protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), '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_name' => array('title'=> "Name", 'type' => 'text', 'width' => 'auto', 'readonly' => 1),
'cron_description' => array('title'=> "Description", 'type' => 'text', 'width' => '35%', '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), '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 // Import Core and Plugin e_cron data
$cronDefaults['_system'] = array( $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.'), 0 => array(
1 => array('name' => 'Mail Queue', 'function' => 'procEmailQueue', 'description' => 'Process mail queue'), 'name' => 'Test Email',
2 => array('name' => 'Mail Bounce Check', 'function' => 'procEmailBounce', 'description' => 'Check for bounced emails', 'available' => vartrue($pref['mail_bounce_auto'])), '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']) if(!$_GET['action'])
@@ -155,6 +174,7 @@ class cron_admin_ui extends e_admin_ui
$insert = array( $insert = array(
'cron_id' => 0, 'cron_id' => 0,
'cron_name' => $val['name'], 'cron_name' => $val['name'],
'cron_category' => $val['category'],
'cron_description' => $val['description'], 'cron_description' => $val['description'],
'cron_function' => $class."::".$val['function'], 'cron_function' => $class."::".$val['function'],
'cron_tab' => '* * * * *', '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 * 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. // Override the default Options field.
function options($field, $value, $attributes, $id) function options($field, $value, $attributes, $id)
{ {

View File

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

View File

@@ -15,7 +15,7 @@
*/ */
require_once ('../class2.php'); 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')); header('location:'.$e107->url->getUrl('core:core','main','action=index'));
exit; exit;
@@ -599,7 +599,7 @@ switch ($action)
break; break;
case "create" : case "create" :
if(getperms(('4|U1'))) if(getperms(('4|U1|U0')))
{ {
$userMethods->deleteExpired(); // Remove time-expired users $userMethods->deleteExpired(); // Remove time-expired users
$user->user_add($user_data); $user->user_add($user_data);
@@ -616,7 +616,7 @@ switch ($action)
break; break;
default : default :
if(getperms('4|U1')) if(getperms('4|U1|U0'))
{ {
$user->show_existing_users($action,$sub_action,$id,$from,$amount); $user->show_existing_users($action,$sub_action,$id,$from,$amount);
} }
@@ -643,10 +643,10 @@ class users
$var = array(); $var = array();
$var ['main']['text'] = LAN_USER_LIST; $var ['main']['text'] = LAN_USER_LIST;
$var ['main']['link'] = e_ADMIN.'users.php'; $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']['text'] = LAN_USER_QUICKADD;
$var ['create']['link'] = e_ADMIN.'users.php?create'; $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']['text'] = LAN_USER_PRUNE;
$var ['prune']['link'] = e_ADMIN.'users.php?prune';// Will be moved to "Schedule tasks" $var ['prune']['link'] = e_ADMIN.'users.php?prune';// Will be moved to "Schedule tasks"
$var ['prune']['perm'] = '4'; $var ['prune']['perm'] = '4';
@@ -734,10 +734,12 @@ class users
} }
$this->fields['options'] = array('title' => LAN_OPTIONS,'width' => '10%',"thclass" => "center last",'forced' => true); $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['checkboxes']);
unset($this->fields['options']); 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); // print_a($this->fields);
} }
@@ -1364,7 +1366,7 @@ class users
function show_batch_options() function show_batch_options()
{ {
if(!getperms('4')) if(!getperms('4|U0'))
{ {
return; return;
} }

View File

@@ -851,14 +851,15 @@ class e_userperms
// Users // Users
"3" => array(ADMSLAN_21,E_16_ADMIN, E_32_ADMIN), // Modify Admin perms "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 "4" => array(LAN_USER_MANAGEALL,E_16_USER, E_32_USER), // Manage all user access and settings etc
"U1" => array(LAN_USER_QUICKADD,E_16_USER, E_32_USER), // USRLAN_72, // "User: Quick Add User", "U0" => array(ADMSLAN_22,E_16_USER, E_32_USER), // moderate users/bans but not userclasses or extended fields,
"U2" => array(LAN_USER_OPTIONS,E_16_USER, E_32_USER), "U1" => array(LAN_USER_QUICKADD,E_16_USER, E_32_USER), // "User: Quick Add User",
"U3" => array(LAN_USER_RANKS,E_16_USER, E_32_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 "W" => array(ADMSLAN_65,E_16_MAIL, E_32_MAIL), // Configure mail settings and mailout
// Content
// Content
"5" => array(ADMSLAN_23,E_16_CUST, E_32_CUST), // create/edit custom PAGES "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 "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 "H" => array(ADMSLAN_39,E_16_NEWS, E_32_NEWS), // Post News

View File

@@ -352,6 +352,7 @@ define('LAN_UI_PREF_LABEL', 'Settings');
define('LAN_UI_DELETE_LABEL', 'Confirm Delete'); 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_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_LIST", "User List");
define("LAN_USER_QUICKADD","Quick Add User"); define("LAN_USER_QUICKADD","Quick Add User");
define("LAN_USER_PRUNE", "Prune Users"); define("LAN_USER_PRUNE", "Prune Users");

View File

@@ -33,12 +33,14 @@ class gsitemap_cron // include plugin-folder in the name.
$cron[] = array( $cron[] = array(
'name' => "Update Records", 'name' => "Update Records",
'function' => "myfunction", 'function' => "myfunction",
'category' => '',
'description' => "Dummy example." 'description' => "Dummy example."
); );
$cron[] = array( $cron[] = array(
'name' => "Test Email", 'name' => "Test Email",
'function' => "sendEmail", 'function' => "sendEmail",
'category' => 'mail', // mail, user, content, notify, backup
'description' => "Sends a test email to ".$pref['siteadminemail'] '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() public function config()
{ {
$cron = array(); $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; 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 * 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. * Write your list query without any Order or Limit.
* NOTE: $tableJoin array is recommended join method
* *
* @var string [optional] * @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()) // 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}"; //protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
// required - if no custom model is set in init() (primary id) // required - if no custom model is set in init() (primary id)