コード例 #1
0
             }
         }
         $group->setAdminClearance($newAdminClearance);
         $group->writeToPersistence();
         $group->applyToUsers();
         $log = new CMS_log();
         $log->logMiscAction(CMS_log::LOG_ACTION_PROFILE_GROUP_EDIT, $cms_user, "Group : " . $group->getLabel() . " (edit admin clearances)");
         $content = array('success' => true);
         $cms_message = $cms_language->getMessage(MESSAGE_PAGE_DATA_SAVED_GROUP);
     }
     break;
 case 'identity':
     //set return to false by default
     $content = array('success' => false);
     if (!isset($group) || !is_a($group, "CMS_profile_usersGroup")) {
         $group = new CMS_profile_usersGroup();
     }
     //is it a new user creation ?
     $groupCreation = $group->getGroupId() ? false : true;
     $group->setLabel($label);
     $group->setDescription($description);
     // Check if any errors when updating group datas
     if (!$cms_message) {
         $group->writeToPersistence();
         $log = new CMS_log();
         if (!$groupCreation) {
             $log->logMiscAction(CMS_log::LOG_ACTION_PROFILE_GROUP_EDIT, $cms_user, "Group : " . $group->getLabel() . "(Edit group identity)");
         } else {
             $log->logMiscAction(CMS_log::LOG_ACTION_PROFILE_GROUP_EDIT, $cms_user, "Group : " . $group->getLabel() . "(Creation)");
         }
         if ($groupCreation) {
コード例 #2
0
ファイル: group.php プロジェクト: davidmottet/automne
$view->setSecure();
//check user rights
if (!$cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITUSERS)) {
    CMS_grandFather::raiseError('User has no users management rights ...');
    $view->show();
}
//load group if any
if (sensitiveIO::isPositiveInteger($groupId)) {
    $group = CMS_profile_usersGroupsCatalog::getByID($groupId);
    if (!$group || $group->hasError()) {
        CMS_grandFather::raiseError('Unknown group for given Id : ' . $groupId);
        $view->show();
    }
} else {
    //create new group
    $group = new CMS_profile_usersGroup();
}
//MAIN TAB
//Need to sanitize all datas which can contain single quotes
$label = sensitiveIO::sanitizeJSString($group->getLabel());
$labelValue = $label ? "value:'{$label}'," : '';
$description = addslashes(sensitiveIO::sanitizeJSString($group->getDescription(), false, true, true));
//get records / pages
$recordsPerPage = CMS_session::getRecordsPerPage();
$usersTab = $modulesTab = $adminTab = '';
//USERS TAB
$usersTab = ",{\n\t\tid:\t\t\t\t\t'groupUsers-{$groupId}',\n\t\ttitle:\t\t\t\t'{$cms_language->getMessage(MESSAGE_PAGE_USERS)}',\n\t\txtype:\t\t\t\t'grid',\n\t\tstore: \t\t\t\tstore,\n\t\tborder:\t\t\t\tfalse,\n\t\tautoExpandColumn:\t'description',\n\t\tcm: \t\t\t\tnew Ext.grid.ColumnModel([\n\t\t\tsm,\n\t\t\t{header: \"ID\", \t\t\t\t\t\t\t\t\t\t\t\t\twidth: 30, \tdataIndex: 'id', \t\t\tsortable: true, \thidden:true},\n\t\t\t{header: \"{$cms_language->getJsMessage(MESSAGE_PAGE_NAME)}\", \t\twidth: 80, \tdataIndex: 'lastName', \t\tsortable: true,\t\t\t\t\t\trenderer:renderUsers},\n\t\t\t{header: \"{$cms_language->getJsMessage(MESSAGE_PAGE_FIRSTNAME)}\", width: 80, \tdataIndex: 'firstName', \tsortable: true},\n\t\t\t{header: \"{$cms_language->getJsMessage(MESSAGE_PAGE_EMAIL)}\", \twidth: 120, dataIndex: 'email', \t\tsortable: false, \thidden:true, \trenderer:function(value) {return '<a href=\"mailto:'+value+'\">'+value+'</a>';}},\n\t\t\t{header: \"{$cms_language->getJsMessage(MESSAGE_PAGE_ACTIVE)}\", \twidth: 20, \tdataIndex: 'active', \t\tsortable: true, \t\t\t\t\trenderer:function(value) {return value == 1 ? '{$cms_language->getJsMessage(MESSAGE_PAGE_YES)}' : '{$cms_language->getJsMessage(MESSAGE_PAGE_NO)}';}}\n\t\t]),\n\t\tsm: \t\t\t\tsm,\n\t\tanchor:\t\t\t\t'100%',\n\t\tviewConfig: \t\t{\n\t\t\tforceFit:\t\t\ttrue\n\t\t},\n\t\ttbar:[{\n\t\t\txtype: \t\t\t'textfield',\n\t\t\temptyText:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_SEARCH)} ...',\n\t\t\tid: \t\t\t'groupSearch-{$groupId}',\n\t\t\tselectOnFocus: \ttrue,\n\t\t\twidth:\t\t\t300,\n\t\t\tlisteners: \t\t{\n\t\t\t\t'render': {fn:function(){\n\t\t\t\t\tExt.getCmp('groupSearch-{$groupId}').getEl().on('keyup', filter, this, {buffer:500});\n\t\t\t\t}, scope:groupWindow}\n\t\t\t}\n\t\t},'-',{\n\t\t\txtype:\t\t\t'checkbox',\n\t\t\tboxLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_ALL_USERS)}',\n\t\t\tlisteners:\t\t{'check': function(item, checked) {\n\t\t\t\tif (checked) {\n\t\t\t\t\tfilterGroupsUsers = false;\n\t\t\t\t} else {\n\t\t\t\t\tfilterGroupsUsers = true;\n\t\t\t\t}\n\t\t\t\tfilter();\n\t\t\t}}\n\t\t}],\n\t\tbbar:\t\t\t\tnew Ext.PagingToolbar({\n\t\t\tpageSize: \t\t\t{$recordsPerPage},\n\t\t\tstore: \t\t\t\tstore,\n\t\t\tdisplayInfo: \t\ttrue,\n\t\t\tdisplayMsg: \t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_USER_X_ON)}',\n\t\t\temptyMsg: \t\t\t\"{$cms_language->getJsMessage(MESSAGE_PAGE_NO_USER)} ...\"\n\t\t})\n\t}";
//Modules tabs
$modulesTab = ",{\n\t\tid:\t\t\t\t\t'groupPages-{$groupId}',\n\t\ttitle:\t\t\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_PAGE)}',\n\t\tborder:\t\t\t\tfalse,\n\t\txtype:\t\t\t\t'atmPanel',\n\t\tautoScroll:\t\t\ttrue,\n\t\tautoLoad:\t\t{\n\t\t\turl:\t\t'user-modules-rights.php',\n\t\t\tparams:\t\t\t{\n\t\t\t\tfatherId:\t\tgroupWindow.id,\n\t\t\t\twinId:\t\t\t'groupPages-{$groupId}',\n\t\t\t\tgroupId:\t\tgroupWindow.groupId\n\t\t\t},\n\t\t\tnocache:\ttrue\n\t\t}\n\t}";
$modules = CMS_modulesCatalog::getAll();
unset($modules[MOD_STANDARD_CODENAME]);