Exemplo n.º 1
0
 function testOnbtainUserdefined()
 {
     $quick = new Perms_Reflection_Quick();
     $current = new Perms_Reflection_PermissionSet();
     $current->add('Anonymous', 'view');
     $obtained = $quick->getPermissions($current, array('Anonymous' => 'userdefined'));
     $expect = new Perms_Reflection_PermissionSet();
     $expect->add('Anonymous', 'view');
     $this->assertEquals($expect, $obtained);
 }
Exemplo n.º 2
0
    foreach ($qperms as $type => $data) {
        $quickperms->configure($type, $data['data']);
    }
    if (isset($_REQUEST['assign']) && isset($_REQUEST['quick_perms'])) {
        check_ticket('object-perms');
        $groups = $userlib->get_groups(0, -1, 'groupName_asc', '', '', 'n');
        $userInput = array();
        foreach ($groups['data'] as $group) {
            if (isset($_REQUEST['perm_' . $group['groupName']])) {
                $group = $group['groupName'];
                $permission = $_REQUEST['perm_' . $group];
                $userInput[$group] = $permission;
            }
        }
        $current = $currentObject->getDirectPermissions();
        $newPermissions = $quickperms->getPermissions($current, $userInput);
        $permissionApplier->apply($newPermissions);
    }
}
// }}}
// Prepare display
// Get the individual object permissions if any
$displayedPermissions = get_displayed_permissions();
if (isset($_REQUEST['used_groups'])) {
    $group_filter = array();
    foreach ($displayedPermissions->getPermissionArray() as $group => $perms) {
        $group_filter[] = $group;
        $group_filter = array_merge($group_filter, $userlib->get_including_groups($group, 'y'));
    }
    if (empty($group_filter)) {
        $group_filter = array('Anonymous', 'Registered', 'Admins');