Exemplo n.º 1
0
} else {
    $categories = ACLRole::getRoleActions('');
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if (isset($_REQUEST['return_module'])) {
    $return['module'] = $_REQUEST['return_module'];
    if (isset($_REQUEST['return_action'])) {
        $return['action'] = $_REQUEST['return_action'];
    }
    if (isset($_REQUEST['return_record'])) {
        $return['record'] = $_REQUEST['return_record'];
    }
}
$sugar_smarty->assign('RETURN', $return);
$names = ACLAction::setupCategoriesMatrix($categories);
if (!empty($names)) {
    $tdwidth = 100 / sizeof($names);
}
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('CATEGORY_NAME', $_REQUEST['category_name']);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$actions = $categories[$_REQUEST['category_name']]['module'];
$sugar_smarty->assign('ACTIONS', $actions);
ob_clean();
if ($_REQUEST['category_name'] == 'All') {
    echo $sugar_smarty->fetch('modules/ACLRoles/EditAllBody.tpl');
} else {
    //WDong Bug 23195: Strings not localized in Role Management.
    echo getClassicModuleTitle($_REQUEST['category_name'], array($app_list_strings['moduleList'][$_REQUEST['category_name']]), false);
Exemplo n.º 2
0
 public function testsetupCategoriesMatrix()
 {
     //preset required data
     $categories = array();
     $categories['Accounts']['module']['list'][] = 'list';
     $categories['Accounts']['module']['edit'][] = 'edit';
     $names_expected = array('list' => 'List', 'edit' => 'Edit');
     $categories_expected = array('Accounts' => array('module' => array('list' => array('list', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array(90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None')), 'edit' => array('edit', 'accessColor' => false, 'accessName' => false, 'accessLabel' => false, 'accessOptions' => array(90 => 'All', 80 => 'Group', 75 => 'Owner', 0 => 'Not Set', -99 => 'None')))));
     //execute the method and verify that it retunrs expected results
     $result = ACLAction::setupCategoriesMatrix($categories);
     $this->assertSame($names_expected, $result);
     $this->assertSame($categories, $categories_expected);
 }