当前位置: 首页>>代码示例>>PHP>>正文


PHP Permission::removeAccess方法代码示例

本文整理汇总了PHP中Permission::removeAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::removeAccess方法的具体用法?PHP Permission::removeAccess怎么用?PHP Permission::removeAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permission的用法示例。


在下文中一共展示了Permission::removeAccess方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: storePermissions

 private function storePermissions()
 {
     global $objDatabase;
     $status = true;
     if ($this->protected) {
         // set protection
         if ($this->access_id || ($this->access_id = \Permission::createNewDynamicAccessId())) {
             \Permission::removeAccess($this->access_id, 'dynamic');
             if (count($this->access_groups)) {
                 \Permission::setAccess($this->access_id, 'dynamic', $this->access_groups);
             }
         } else {
             // remove protection due that no new access-ID could have been created
             $this->access_id = 0;
             $status = false;
         }
     } elseif ($this->access_id) {
         // remove protection
         \Permission::removeAccess($this->access_id, 'dynamic');
         $this->access_id = 0;
     }
     if (!$status) {
         return false;
     }
     if ($objDatabase->Execute("\n            UPDATE `" . DBPREFIX . "module_downloads_download`\n            SET\n                `access_id` = " . intval($this->access_id) . "\n            WHERE `id` = " . $this->id) === false) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:30,代码来源:Download.class.php

示例2: _saveSettings

 /**
  * Validate and save settings from $_POST into the database.
  *
  * @global  ADONewConnection
  * @global  array $_ARRAYLANG
  */
 function _saveSettings()
 {
     global $objDatabase, $_ARRAYLANG;
     $this->_arrSettings = $this->createSettingsArray();
     for ($i = 0; $i <= 4; $i++) {
         $oldMediaSetting = $this->_arrSettings['media' . $i . '_frontend_changable'];
         $newMediaSetting = '';
         if (isset($_POST['mediaSettings_Media' . $i . 'FrontendChangable'])) {
             $newMediaSetting = $_POST['mediaSettings_Media' . $i . 'FrontendChangable'];
         }
         if (!is_numeric($newMediaSetting)) {
             if (is_numeric($oldMediaSetting)) {
                 // remove AccessId
                 \Permission::removeAccess($oldMediaSetting, 'dynamic');
             }
             // save new setting
             $objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_media_settings
                                             SET `value` = "' . contrexx_addslashes($newMediaSetting) . '"
                                             WHERE `name` = "media' . $i . '_frontend_changable"
                                         ');
         } else {
             $accessGroups = '';
             if (isset($_POST['media' . $i . '_access_associated_groups'])) {
                 $accessGroups = $_POST['media' . $i . '_access_associated_groups'];
             }
             // get groups
             \Permission::removeAccess($oldMediaSetting, 'dynamic');
             if (isset($_POST['media' . $i . '_access_associated_groups'])) {
                 $accessGroups = $_POST['media' . $i . '_access_associated_groups'];
             }
             // add AccessID
             $newMediaSetting = \Permission::createNewDynamicAccessId();
             // save AccessID
             if (count($accessGroups)) {
                 \Permission::setAccess($newMediaSetting, 'dynamic', $accessGroups);
             }
             $query = 'UPDATE ' . DBPREFIX . 'module_media_settings
                           SET `value` = "' . intval($newMediaSetting) . '"
                           WHERE `name` = "media' . $i . '_frontend_changable"';
             $objDatabase->Execute($query);
         }
         $oldManageSetting = $this->_arrSettings['media' . $i . '_frontend_managable'];
         $newManageSetting = '';
         if (isset($_POST['mediaSettings_Media' . $i . 'FrontendManagable'])) {
             $newManageSetting = $_POST['mediaSettings_Media' . $i . 'FrontendManagable'];
         }
         if (!is_numeric($newManageSetting)) {
             if (is_numeric($oldManageSetting)) {
                 // remove AccessId
                 \Permission::removeAccess($oldManageSetting, 'dynamic');
             }
             // save new setting
             $objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_media_settings
                                             SET `value` = "' . contrexx_addslashes($newManageSetting) . '"
                                             WHERE `name` = "media' . $i . '_frontend_managable"
                                         ');
         } else {
             $accessGroups = '';
             if (isset($_POST['media' . $i . '_manage_associated_groups'])) {
                 $accessGroups = $_POST['media' . $i . '_manage_associated_groups'];
             }
             // get groups
             \Permission::removeAccess($oldManageSetting, 'dynamic');
             if (isset($_POST['media' . $i . '_manage_associated_groups'])) {
                 $accessGroups = $_POST['media' . $i . '_manage_associated_groups'];
             }
             // add AccessID
             $newManageSetting = \Permission::createNewDynamicAccessId();
             // save AccessID
             if (count($accessGroups)) {
                 \Permission::setAccess($newManageSetting, 'dynamic', $accessGroups);
             }
             $objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_media_settings
                                             SET `value` = "' . intval($newManageSetting) . '"
                                             WHERE `name` = "media' . $i . '_frontend_managable"
                                         ');
         }
     }
     $this->_arrSettings = $this->createSettingsArray();
     $this->_strOkMessage = $_ARRAYLANG['TXT_MEDIA_SETTINGS_SAVE_SUCCESSFULL'];
 }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:87,代码来源:MediaManager.class.php

示例3: eraseAccessId

 protected function eraseAccessId($id)
 {
     \Permission::removeAccess($id, 'dynamic');
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:4,代码来源:Page.class.php

示例4: saveSettings

 private function saveSettings()
 {
     global $objDatabase;
     /**
      * save mailtemplates
      */
     foreach ($_POST["filesharingMail"] as $lang => $inputs) {
         $objMailTemplate = $objDatabase->Execute("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . intval($lang));
         $content = str_replace(array('{', '}'), array('[[', ']]'), contrexx_input2db($inputs["content"]));
         if ($objMailTemplate === false or $objMailTemplate->RecordCount() == 0) {
             $objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_filesharing_mail_template (`subject`, `content`, `lang_id`) VALUES ('" . contrexx_input2db($inputs["subject"]) . "', '" . contrexx_raw2db($content) . "', '" . contrexx_raw2db($lang) . "')");
         } else {
             $objDatabase->Execute("UPDATE " . DBPREFIX . "module_filesharing_mail_template SET `subject` = '" . contrexx_input2db($inputs["subject"]) . "', `content` = '" . contrexx_raw2db($content) . "' WHERE `lang_id` = '" . contrexx_raw2db($lang) . "'");
         }
     }
     /**
      * save permissions
      */
     \Cx\Core\Setting\Controller\Setting::init('FileSharing', 'config');
     $oldFilesharingSetting = \Cx\Core\Setting\Controller\Setting::getValue('permission', 'FileSharing');
     $newFilesharingSetting = $_POST['filesharingSettingsPermission'];
     if (!is_numeric($newFilesharingSetting)) {
         if (is_numeric($oldFilesharingSetting)) {
             // remove AccessId
             \Permission::removeAccess($oldFilesharingSetting, 'dynamic');
         }
     } else {
         $accessGroups = '';
         if (isset($_POST['filesharing_access_associated_groups'])) {
             $accessGroups = $_POST['filesharing_access_associated_groups'];
         }
         // get groups
         \Permission::removeAccess($oldFilesharingSetting, 'dynamic');
         if (isset($_POST['filesharing_access_associated_groups'])) {
             $accessGroups = $_POST['filesharing_access_associated_groups'];
         }
         // add AccessID
         $newFilesharingSetting = \Permission::createNewDynamicAccessId();
         // save AccessID
         if (count($accessGroups)) {
             \Permission::setAccess($newFilesharingSetting, 'dynamic', $accessGroups);
         }
     }
     // save new setting
     \Cx\Core\Setting\Controller\Setting::set('permission', $newFilesharingSetting);
     \Cx\Core\Setting\Controller\Setting::updateAll();
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:47,代码来源:FileSharingManager.class.php

示例5: update

 /**
  * Update news
  *
  * @global    ADONewConnection
  * @global    array
  * @global    array
  * @param     integer   $newsid
  * @return    boolean   result
  */
 function update()
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     if (!$this->hasCategories()) {
         return $this->manageCategories();
     }
     if (isset($_POST['newsId'])) {
         $objFWUser = \FWUser::getFWUserObject();
         $id = intval($_POST['newsId']);
         $userId = $objFWUser->objUser->getId();
         $changelog = mktime();
         $date = $this->dateFromInput($_POST['newsDate']);
         $redirect = !empty($_POST['newsRedirect']) && $_POST['newsTypeRadio'] == 'redirect' ? contrexx_strip_tags($_POST['newsRedirect']) : '';
         $source = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsSource']));
         $url1 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl1']));
         $url2 = \FWValidator::getUrl(contrexx_strip_tags($_POST['newsUrl2']));
         $newsPublisherName = !empty($_POST['newsPublisherName']) ? contrexx_input2raw($_POST['newsPublisherName']) : '';
         $newsAuthorName = !empty($_POST['newsAuthorName']) ? contrexx_input2raw($_POST['newsAuthorName']) : '';
         $newsPublisherId = !empty($_POST['newsPublisherId']) ? contrexx_input2raw($_POST['newsPublisherId']) : '0';
         $newsAuthorId = !empty($_POST['newsAuthorId']) ? contrexx_input2raw($_POST['newsAuthorId']) : '0';
         $newsCategories = !empty($_POST['newsCat']) ? contrexx_input2raw($_POST['newsCat']) : array();
         $typeId = !empty($_POST['newsType']) ? intval($_POST['newsType']) : 0;
         $newsScheduledActive = !empty($_POST['newsScheduled']) ? intval($_POST['newsScheduled']) : 0;
         $status = empty($_POST['status']) ? $status = 0 : intval($_POST['status']);
         $newsTeaserOnly = isset($_POST['newsUseOnlyTeaser']) ? intval($_POST['newsUseOnlyTeaser']) : 0;
         $newsTeaserShowLink = isset($_POST['newsTeaserShowLink']) ? intval($_POST['newsTeaserShowLink']) : 0;
         $newsTeaserImagePath = contrexx_addslashes($_POST['newsTeaserImagePath']);
         $newsTeaserImageThumbnailPath = contrexx_addslashes($_POST['newsTeaserImageThumbnailPath']);
         $newsTeaserFrames = '';
         $newsComments = !empty($_POST['allowComment']) ? intval($_POST['allowComment']) : 0;
         if (isset($_POST['newsTeaserFramesAsso']) && count($_POST['newsTeaserFramesAsso']) > 0) {
             foreach ($_POST['newsTeaserFramesAsso'] as $frameId) {
                 intval($frameId) > 0 ? $newsTeaserFrames .= ';' . intval($frameId) : false;
             }
         }
         $startDate = $this->dateFromInput($_POST['startDate']);
         $endDate = $this->dateFromInput($_POST['endDate']);
         $newsFrontendAccess = !empty($_POST['news_read_access']);
         $newsFrontendGroups = $newsFrontendAccess && isset($_POST['news_read_access_associated_groups']) && is_array($_POST['news_read_access_associated_groups']) ? array_map('intval', $_POST['news_read_access_associated_groups']) : array();
         $newsBackendAccess = !empty($_POST['news_modify_access']);
         $newsBackendGroups = $newsBackendAccess && isset($_POST['news_modify_access_associated_groups']) && is_array($_POST['news_modify_access_associated_groups']) ? array_map('intval', $_POST['news_modify_access_associated_groups']) : array();
         $objResult = $objDatabase->SelectLimit('SELECT `frontend_access_id`, `backend_access_id`, `userid` FROM `' . DBPREFIX . 'module_news` WHERE `id` = ' . $id, 1);
         if ($objResult && $objResult->RecordCount() == 1) {
             $newsFrontendAccessId = $objResult->fields['frontend_access_id'];
             $newsBackendAccessId = $objResult->fields['backend_access_id'];
             $newsUserId = $objResult->fields['userid'];
         } else {
             $newsFrontendAccessId = 0;
             $newsBackendAccessId = 0;
             $newsUserId = 0;
         }
         if ($this->arrSettings['news_message_protection'] == '1') {
             if ($newsBackendAccessId && !\Permission::hasAllAccess() && !\Permission::checkAccess($newsBackendAccessId, 'dynamic', true) && $newsUserId != $objFWUser->objUser->getId()) {
                 return false;
             }
             if ($newsFrontendAccess) {
                 if ($newsFrontendAccessId) {
                     $objGroup = $objFWUser->objGroup->getGroups(array('dynamic' => $newsFrontendAccessId));
                     $arrFormerFrontendGroupIds = $objGroup ? $objGroup->getLoadedGroupIds() : array();
                     $arrNewGroups = array_diff($newsFrontendGroups, $arrFormerFrontendGroupIds);
                     $arrRemovedGroups = array_diff($arrFormerFrontendGroupIds, $newsFrontendGroups);
                     if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
                         $arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
                         $arrUnknownNewGroups = array_diff($arrNewGroups, $arrUserGroupIds);
                         foreach ($arrUnknownNewGroups as $groupId) {
                             if (!in_array($groupId, $arrFormerFrontendGroupIds)) {
                                 unset($arrNewGroups[array_search($groupId, $arrNewGroups)]);
                             }
                         }
                         $arrUnknownRemovedGroups = array_diff($arrRemovedGroups, $arrUserGroupIds);
                         foreach ($arrUnknownRemovedGroups as $groupId) {
                             if (in_array($groupId, $arrFormerFrontendGroupIds)) {
                                 unset($arrRemovedGroups[array_search($groupId, $arrRemovedGroups)]);
                             }
                         }
                     }
                     if (count($arrRemovedGroups)) {
                         \Permission::removeAccess($newsFrontendAccessId, 'dynamic', $arrRemovedGroups);
                     }
                     if (count($arrNewGroups)) {
                         \Permission::setAccess($newsFrontendAccessId, 'dynamic', $arrNewGroups);
                     }
                 } else {
                     if ($this->arrSettings['news_message_protection_restricted'] == '1' && !\Permission::hasAllAccess()) {
                         $arrUserGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
                         $newsFrontendGroups = array_intersect($newsFrontendGroups, $arrUserGroupIds);
                     }
                     $newsFrontendAccessId = \Permission::createNewDynamicAccessId();
                     if (count($newsFrontendGroups)) {
                         \Permission::setAccess($newsFrontendAccessId, 'dynamic', $newsFrontendGroups);
                     }
//.........这里部分代码省略.........
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:NewsManager.class.php

示例6: set


//.........这里部分代码省略.........
                 $page->setActive(false);
                 break;
             case 'show':
                 $page->setDisplay(true);
                 break;
             case 'hide':
                 $page->setDisplay(false);
                 break;
             case 'protect':
                 $page->setFrontendProtection(true);
                 break;
             case 'unprotect':
                 $page->setFrontendProtection(false);
                 break;
             case 'lock':
                 $page->setBackendProtection(true);
                 break;
             case 'unlock':
                 $page->setBackendProtection(false);
                 break;
         }
         if ($action != 'publish' && !$page->isDraft()) {
             $action = 'publish';
         }
     }
     $page->setUpdatedAtToNow();
     $page->validate();
     // Permissions are only updated in the editing mode.
     if (!empty($pageArray)) {
         if ($action == 'publish') {
             if (\Permission::checkAccess(36, 'static', true)) {
                 if ($page->isFrontendProtected()) {
                     // remove all
                     \Permission::removeAccess($page->getFrontendAccessId(), 'dynamic');
                     if (isset($dataPost['frontendGroups'])) {
                         // set new
                         $pg->setAssignedGroupIds($page, $dataPost['frontendGroups'], true);
                     }
                 }
                 if ($page->isBackendProtected()) {
                     // remove all
                     $groupIds = $pg->getAssignedGroupIds($page, false);
                     \Permission::removeAccess($page->getBackendAccessId(), 'dynamic');
                     if (isset($dataPost['backendGroups'])) {
                         // set new
                         $pg->setAssignedGroupIds($page, $dataPost['backendGroups'], false);
                     }
                     if ($page->isBackendProtected() && !\Permission::checkAccess($page->getBackendAccessId(), 'dynamic', true)) {
                         if (!count($groupIds)) {
                             $page->setBackendProtection(false);
                         } else {
                             $pg->setAssignedGroupIds($page, $groupIds, false);
                         }
                     }
                 }
             }
         }
     }
     // Block associations are only updated in the editing mode.
     if (!empty($pageArray) && empty($dataPost['ignoreBlocks'])) {
         if (!isset($dataPost['pageBlocks'])) {
             $dataPost['pageBlocks'] = array();
         }
         $page->setRelatedBlocks($dataPost['pageBlocks']);
     }
     $draftUpdateLog = null;
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:67,代码来源:JsonPage.class.php

示例7: storePermissions

 private function storePermissions()
 {
     global $objDatabase;
     if (!$this->permission_set) {
         return true;
     }
     $status = true;
     foreach ($this->arrPermissionTypes as $type) {
         if ($this->{$type . '_protected'}) {
             // set protection
             if ($this->{$type . '_access_id'} || ($this->{$type . '_access_id'} = \Permission::createNewDynamicAccessId())) {
                 \Permission::removeAccess($this->{$type . '_access_id'}, 'dynamic');
                 if (count($this->{$type . '_groups'})) {
                     \Permission::setAccess($this->{$type . '_access_id'}, 'dynamic', $this->{$type . '_groups'});
                 }
             } else {
                 // remove protection due that no new access-ID could have been created
                 $this->{$type . '_access_id'} = 0;
                 $status = false;
             }
         } elseif ($this->{$type . '_access_id'}) {
             // remove protection
             \Permission::removeAccess($this->{$type . '_access_id'}, 'dynamic');
             $this->{$type . '_access_id'} = 0;
         }
     }
     if (!$status) {
         return false;
     }
     if ($objDatabase->Execute("\n            UPDATE `" . DBPREFIX . "module_downloads_category`\n            SET\n                `read_access_id` = " . intval($this->read_access_id) . ",\n                `add_subcategories_access_id` = " . intval($this->add_subcategories_access_id) . ",\n                `manage_subcategories_access_id` = " . intval($this->manage_subcategories_access_id) . ",\n                `add_files_access_id` = " . intval($this->add_files_access_id) . ",\n                `manage_files_access_id` = " . intval($this->manage_files_access_id) . "\n            WHERE `id` = " . $this->id) === false) {
         return false;
     } else {
         if ($this->set_permissions_recursive) {
             foreach ($this->arrPermissionTypes as $type) {
                 $arrPermissions[$type] = array('protected' => $this->{$type . '_protected'}, 'groups' => $this->{$type . '_groups'});
             }
             $objSubcategory = Category::getCategories(array('parent_id' => $this->getId()));
             while (!$objSubcategory->EOF) {
                 $objSubcategory->setPermissionsRecursive(true);
                 $objSubcategory->setPermissions($arrPermissions);
                 $objSubcategory->setVisibility($this->visibility);
                 $objSubcategory->store();
                 $objSubcategory->next();
             }
         }
         return true;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:48,代码来源:Category.class.php


注:本文中的Permission::removeAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。