Beispiel #1
0
 public function allow()
 {
     // Users in the admin group always pass permission tests.
     if (Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) {
         return true;
     }
     if ($this->_page->pageid()) {
         $pageperm = new Model_PagePerm();
         $pageperm->where('pageid = ?', $this->_page->pageid());
         $pageperm->where('usergroupid = ? OR usergroupid = 0', Typeframe::User()->get('usergroupid'));
         return $pageperm->count() > 0;
     }
     return true;
 }
Beispiel #2
0
<?php

$page->setArray($_POST);
$page->save();
$pageperms = new Model_PagePerm();
$pageperms->where('pageid = ?', $page['pageid']);
$pageperms->deleteQuery();
if (isset($_REQUEST['usergroupid']) && count($_REQUEST['usergroupid']) > 0 && array_search('0', $_REQUEST['usergroupid']) === false) {
    foreach ($_REQUEST['usergroupid'] as $usergroupid) {
        //$pageperm = new PagePerm($page->get('id'), $usergroupid);
        //$pageperm->save();
        $pageperm = Model_PagePerm::Create();
        $pageperm['pageid'] = $page['id'];
        $pageperm['usergroupid'] = $usergroupid;
        $pageperm->save();
    }
} else {
    //$pageperm = new PagePerm($page->get('id'), 0);
    $pageperm = Model_PagePerm::Create();
    $pageperm['pageid'] = $page['id'];
    $pageperm['usergroup'] = 0;
    $pageperm->save();
}
Typeframe::Registry()->purgeRegistryCache();
Beispiel #3
0
<?php

$usergroups = new Model_Usergroup();
$usergroups->order('usergroupname');
$selected = array();
if ($page->exists()) {
    $selectedGroups = new Model_PagePerm();
    $selectedGroups->where('pageid = ?', $page['id']);
    foreach ($selectedGroups->getAll() as $s) {
        $selected[] = $s['usergroupid'];
    }
}
$pm->addLoop('usergroups', array('usergroupid' => '0', 'usergroupname' => 'Everyone', 'selected' => in_array(0, $selected) ? true : false));
foreach ($usergroups->getAll() as $usergroup) {
    if (in_array($usergroup['usergroupid'], $selected)) {
        $usergroup['selected'] = true;
    }
    $pm->addLoop('usergroups', $usergroup);
}
foreach (Typeframe::Registry()->applications() as $app) {
    //if ('soft' == $app->map())
    $pm->addLoop('applications', array('application' => $app->name()));
}
$pm->sortLoop('applications', 'application');
if (PAGES_DEFAULT_APPLICATION) {
    $app = Typeframe::Registry()->application(PAGES_DEFAULT_APPLICATION);
    //if ($app && ('soft' == $app->map()))
    if ($app) {
        $pm->setVariable('application', PAGES_DEFAULT_APPLICATION);
    }
}