本文整理汇总了PHP中Current_User::isRestricted方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::isRestricted方法的具体用法?PHP Current_User::isRestricted怎么用?PHP Current_User::isRestricted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::isRestricted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorized
/**
* Works the same as the allow static function but confirms the user's authorization code
*
* @param string module Name of the module checking
* @param string subpermission Name of the module permission to verify
* @param integer item_id Id of the item to verify
* @param string itename Name of the item permission
* @param boolean unrestricted_only If true, user must be have unrestricted
* priviledges for that module regardless of
* module, subpermission, or item id
*/
public static function authorized($module, $subpermission = null, $item_id = 0, $itemname = null, $unrestricted_only = false)
{
if ($unrestricted_only && Current_User::isRestricted($module)) {
return false;
}
if (!isset($_SESSION['User'])) {
return false;
}
return $_SESSION['User']->allow($module, $subpermission, $item_id, $itemname, true);
}
示例2: get
public function get($type)
{
switch ($type) {
case 'new':
if (Current_User::isRestricted('signup')) {
$this->signup->title = dgettext('signup', 'Sorry');
$this->signup->content = dgettext('signup', 'You do not have permission for this action.');
return;
}
case 'edit_sheet':
if (empty($this->signup->sheet)) {
$this->signup->loadSheet();
}
if (!Current_User::allow('signup', 'edit_sheet', $this->signup->sheet->id, 'sheet')) {
Current_User::disallow();
}
$this->editSheet();
break;
case 'list':
$this->signup->panel->setCurrentTab('list');
$this->listSignup();
break;
case 'edit_slots':
$this->editSlots();
break;
case 'edit_peep':
$this->editPeep();
break;
case 'edit_slot_popup':
$this->editSlotPopup();
break;
case 'edit_peep_popup':
$this->editPeepPopup();
break;
case 'user_signup':
$this->userSignup();
break;
case 'report':
$this->report();
break;
case 'email_applicants':
$this->emailApplicants();
break;
}
}
示例3: admin
/**
* Handles admin functions outside of file manager.
* Expects an 'aop' command.
*/
public function admin()
{
$javascript = false;
// if true, sends to nakedDisplay
$this->loadPanel();
if (isset($_REQUEST['aop'])) {
$aop = $_REQUEST['aop'];
} else {
$aop = $this->panel->getCurrentTab();
}
if (!Current_User::isLogged()) {
Current_User::disallow();
return;
}
if ($aop != 'edit_image' && $aop != 'get_images' && !Current_User::allow('filecabinet')) {
Current_User::disallow();
return;
}
// Requires an unrestricted user
switch ($aop) {
case 'delete_folder':
case 'unpin':
if (Current_User::isRestricted('filecabinet')) {
Current_User::disallow();
}
}
switch ($aop) {
case 'image':
$this->panel->setCurrentTab('image');
$this->title = dgettext('filecabinet', 'Image folders');
$this->loadForms();
$this->forms->getFolders(IMAGE_FOLDER);
break;
case 'multimedia':
$this->panel->setCurrentTab('multimedia');
$this->title = dgettext('filecabinet', 'Multimedia folders');
$this->loadForms();
$this->forms->getFolders(MULTIMEDIA_FOLDER);
break;
case 'add_folder':
if (!Current_User::allow('filecabinet', 'edit_folders', null, null, true)) {
Current_User::disallow();
}
$javascript = true;
$this->loadFolder();
$this->addFolder();
break;
case 'classify':
if (!Current_User::isDeity()) {
Current_User::errorPage();
}
$this->loadForms();
$this->forms->classifyFileList();
break;
case 'classify_action':
if (!Current_User::isDeity() || !Current_User::verifyAuthKey()) {
Current_User::errorPage();
}
$this->classifyAction();
break;
case 'classify_file':
if (!Current_User::isDeity() || !Current_User::verifyAuthKey()) {
Current_User::disallow();
}
$this->loadForms();
if (!empty($_POST['file_list'])) {
$this->forms->classifyFile($_POST['file_list']);
} elseif (isset($_GET['file'])) {
$this->forms->classifyFile($_GET['file']);
} else {
$this->forms->classifyFileList();
}
break;
case 'post_classifications':
if (!Current_User::isDeity()) {
Current_User::errorPage();
}
$result = $this->classifyFiles();
if (is_array($result)) {
$this->message = implode('<br />', $result);
}
$this->loadForms();
$this->forms->classifyFileList();
break;
case 'unpin':
if (!Current_User::authorized('filecabinet')) {
Current_User::disallow();
}
Cabinet::unpinFolder();
PHPWS_Core::goBack();
break;
case 'pin_form':
$javascript = true;
@($key_id = (int) $_GET['key_id']);
if (!$key_id) {
javascript('close_refresh', array('refresh' => 0));
//.........这里部分代码省略.........
示例4: disapproveSuggestion
public function disapproveSuggestion($id)
{
if (!Current_User::authorized('calendar', 'edit_public') || Current_User::isRestricted('calendar')) {
PHPWS_Core::errorPage('403');
}
PHPWS_Core::initModClass('calendar', 'Suggestion.php');
$suggestion = new Calendar_Suggestion((int) $id);
if (!$suggestion->id) {
PHPWS_Core::errorPage('404');
}
return $suggestion->delete();
}
示例5: save
public function save()
{
PHPWS_Core::initModClass('search', 'Search.php');
if (!$this->id) {
$new = true;
$this->create_date = time();
} else {
$new = false;
}
$this->last_updated = time();
// If this page has a parent and the order is not set
// then increment
if (!$this->page_order && $this->parent_page) {
$page_order = $this->getLastPage();
if (!PHPWS_Error::logIfError($page_order)) {
$this->page_order = $page_order + 1;
} else {
$this->page_order = 1;
}
}
$db = new PHPWS_DB('ps_page');
if (PHPWS_Error::logIfError($db->saveObject($this))) {
return false;
}
$this->saveKey();
if ($new && Current_User::isRestricted('pagesmith')) {
Current_User::giveItemPermission($this->_key);
}
$search = new Search($this->key_id);
$search->resetKeywords();
$search->addKeywords($this->title);
PHPWS_Error::logIfError($search->save());
foreach ($this->_sections as $section) {
$section->pid = $this->id;
PHPWS_Error::logIfError($section->save($this->key_id));
}
PHPWS_Cache::remove($this->cacheKey());
}
示例6: permission
public static function permission()
{
if (!isset($_REQUEST['key_id'])) {
return;
}
$key = new Key((int) $_REQUEST['key_id']);
if (!Key::checkKey($key, false)) {
return;
}
if (Current_User::isRestricted($key->module) || !$key->allowEdit()) {
Current_User::disallow();
}
// View permissions must be first to allow error checking
// Edit will add its list to the view
Users_Permission::postViewPermissions($key);
Users_Permission::postEditPermissions($key);
$result = $key->savePermissions();
if (isset($_POST['popbox'])) {
Layout::nakedDisplay(javascript('close_refresh', array('refresh' => 0)));
} else {
if (PHPWS_Error::logIfError($result)) {
$_SESSION['Permission_Message'] = dgettext('users', 'An error occurred.');
} else {
$_SESSION['Permission_Message'] = dgettext('users', 'Permissions updated.');
}
PHPWS_Core::goBack();
}
}