Exemple #1
0
                    $pa = PermissionAccess::getByID($paID, $pk);
                    if (is_object($pa)) {
                        $pt->assignPermissionAccess($pa);
                    }
                }
            }
        }
    }
    if ($p->canScheduleGuestAccess()) {
        if ($_REQUEST['task'] == 'set_timed_guest_access' && Loader::helper("validation/token")->validate('set_timed_guest_access')) {
            if (!$b->overrideAreaPermissions()) {
                $b->doOverrideAreaPermissions();
            }
            $pk = PermissionKey::getByHandle('view_block');
            $pk->setPermissionObject($b);
            $pa = $pk->getPermissionAccessObject();
            if (!is_object($pa)) {
                $pa = PermissionAccess::create($pk);
            } else {
                if ($pa->isPermissionAccessInUse()) {
                    $pa = $pa->duplicate();
                }
            }
            $pe = GroupPermissionAccessEntity::getOrCreate(Group::getByID(GUEST_GROUP_ID));
            $pd = PermissionDuration::createFromRequest();
            $pa->addListItem($pe, $pd, PermissionKey::ACCESS_TYPE_INCLUDE);
            $pt = $pk->getPermissionAssignmentObject();
            $pt->assignPermissionAccess($pa);
        }
    }
}