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


PHP Context::setPermission方法代码示例

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


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

示例1: _postSave

 protected function _postSave($is_new)
 {
     if ($is_new) {
         framework\Context::setPermission("canseecomponent", $this->getID(), "core", 0, framework\Context::getUser()->getGroup()->getID(), 0, true);
         \thebuggenie\core\framework\Event::createNew('core', 'Component::createNew', $this)->trigger();
     }
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:7,代码来源:Component.php

示例2: loadFixtures

 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     Category::loadFixtures($scope);
     Priority::loadFixtures($scope);
     Reproducability::loadFixtures($scope);
     Resolution::loadFixtures($scope);
     Severity::loadFixtures($scope);
     Status::loadFixtures($scope);
     Role::loadFixtures($scope);
     ActivityType::loadFixtures($scope);
     foreach (self::getTypes() as $type => $class) {
         framework\Context::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
     }
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:14,代码来源:Datatype.php

示例3: addAssignee

 /**
  * Adds an assignee with a given role
  *
  * @param \thebuggenie\core\entities\common\Identifiable $assignee The user or team to add
  * @param Role $role The role to add
  *
  * @return null
  */
 public function addAssignee($assignee, $role = null)
 {
     $user_id = 0;
     $team_id = 0;
     if ($assignee instanceof \thebuggenie\core\entities\User) {
         $user_id = $assignee->getID();
         if (tables\ProjectAssignedUsers::getTable()->addUserToProject($this->getID(), $user_id, $role->getID()) && is_array($this->_assigned_users)) {
             $this->_assigned_users = array_merge($this->_assigned_users, tables\ProjectAssignedUsers::getTable()->getUserByProjectIDUserIDRoleID($this->getID(), $user_id, $role->getID()));
         }
     } elseif ($assignee instanceof \thebuggenie\core\entities\Team) {
         $team_id = $assignee->getID();
         if (tables\ProjectAssignedTeams::getTable()->addTeamToProject($this->getID(), $team_id, $role->getID()) && is_array($this->_assigned_users)) {
             $this->_assigned_teams = array_merge($this->_assigned_teams, tables\ProjectAssignedTeams::getTable()->getTeamByProjectIDTeamIDRoleID($this->getID(), $team_id, $role->getID()));
         }
     }
     if ($role instanceof \thebuggenie\core\entities\Role) {
         $role_id = $role->getID();
         foreach ($role->getPermissions() as $role_permission) {
             $target_id = strtolower($role_permission->getExpandedTargetID($role));
             tables\Permissions::getTable()->removeSavedPermission($user_id, 0, $team_id, $role_permission->getModule(), $role_permission->getPermission(), $target_id, framework\Context::getScope()->getID(), $role_id);
             framework\Context::setPermission($role_permission->getPermission(), $target_id, $role_permission->getModule(), $user_id, 0, $team_id, true, null, $role_id);
         }
     }
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:32,代码来源:Project.php

示例4: _loadFixtures

 protected function _loadFixtures($scope)
 {
     $this->loadFixturesArticles($scope);
     Links::getTable()->addLink('wiki', 0, 'MainPage', 'Wiki Frontpage', 1, $scope);
     Links::getTable()->addLink('wiki', 0, 'WikiFormatting', 'Formatting help', 2, $scope);
     Links::getTable()->addLink('wiki', 0, 'Category:Help', 'Help topics', 3, $scope);
     framework\Context::setPermission(self::PERMISSION_READ_ARTICLE, 0, 'publish', 0, 1, 0, true, $scope);
     framework\Context::setPermission(self::PERMISSION_EDIT_ARTICLE, 0, 'publish', 0, 1, 0, true, $scope);
     framework\Context::setPermission(self::PERMISSION_DELETE_ARTICLE, 0, 'publish', 0, 1, 0, true, $scope);
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:10,代码来源:Publish.php

示例5: runSetPermission

 public function runSetPermission(framework\Request $request)
 {
     $i18n = framework\Context::getI18n();
     if ($this->access_level == framework\Settings::ACCESS_FULL) {
         $uid = 0;
         $gid = 0;
         $tid = 0;
         switch ($request['target_type']) {
             case 'user':
                 $uid = $request['item_id'];
                 break;
             case 'group':
                 $gid = $request['item_id'];
                 break;
             case 'team':
                 $tid = $request['item_id'];
                 break;
         }
         $target_id = $request->getRawParameter('target_id');
         switch ($request['mode']) {
             case 'allowed':
                 framework\Context::setPermission($request['key'], $target_id, $request['target_module'], $uid, $gid, $tid, true);
                 break;
             case 'denied':
                 framework\Context::setPermission($request['key'], $target_id, $request['target_module'], $uid, $gid, $tid, false);
                 break;
             case 'unset':
                 framework\Context::removePermission($request['key'], $target_id, $request['target_module'], $uid, $gid, $tid, true, null, 0);
                 break;
         }
         return $this->renderJSON(array('content' => $this->getComponentHTML('configuration/permissionsinfoitem', array('key' => $request['key'], 'target_id' => $target_id, 'type' => $request['target_type'], 'mode' => $request['template_mode'], 'item_id' => $request['item_id'], 'module' => $request['target_module'], 'access_level' => $this->access_level))));
     }
     $this->getResponse()->setHttpStatus(400);
     return $this->renderJSON(array("error" => $i18n->__("You don't have access to modify permissions")));
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:35,代码来源:Main.php

示例6: _unlockIssueAfter

 /**
  * @param framework\Request $request
  * @param                   $issue
  */
 protected function _unlockIssueAfter(framework\Request $request, $issue)
 {
     tables\Permissions::getTable()->deleteByPermissionTargetIDAndModule('canviewissue', $issue->getID());
     $al_users = $request->getParameter('access_list_users', array());
     $al_teams = $request->getParameter('access_list_teams', array());
     $i_al = $issue->getAccessList();
     foreach ($i_al as $k => $item) {
         if ($item['target'] instanceof entities\Team) {
             $tid = $item['target']->getID();
             if (array_key_exists($tid, $al_teams)) {
                 unset($i_al[$k]);
             }
         } elseif ($item['target'] instanceof entities\User) {
             $uid = $item['target']->getID();
             if (array_key_exists($uid, $al_users)) {
                 unset($i_al[$k]);
             }
         }
     }
     foreach ($al_users as $uid) {
         framework\Context::setPermission('canviewissue', $issue->getID(), 'core', $uid, 0, 0, true);
     }
     foreach ($al_teams as $tid) {
         framework\Context::setPermission('canviewissue', $issue->getID(), 'core', 0, 0, $tid, true);
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:30,代码来源:Main.php

示例7: runLockIssue

 /**
  * Unlock the issue
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runLockIssue(framework\Request $request)
 {
     if ($issue_id = $request['issue_id']) {
         try {
             $issue = entities\Issue::getB2DBTable()->selectById($issue_id);
             if (!$issue->canEditIssueDetails()) {
                 $this->forward403($this->getI18n()->__("You don't have access to update the issue access policy"));
                 return;
             }
             $issue->setLocked();
             $issue->save();
             framework\Context::setPermission('canviewissue', $issue->getID(), 'core', 0, 0, 0, false);
             framework\Context::setPermission('canviewissue', $issue->getID(), 'core', $this->getUser()->getID(), 0, 0, true);
             $al_users = $request->getParameter('access_list_users', array());
             $al_teams = $request->getParameter('access_list_teams', array());
             $i_al = $issue->getAccessList();
             foreach ($i_al as $k => $item) {
                 if ($item['target'] instanceof entities\Team) {
                     $tid = $item['target']->getID();
                     if (array_key_exists($tid, $al_teams)) {
                         unset($i_al[$k]);
                     } else {
                         framework\Context::removePermission('canviewissue', $issue->getID(), 'core', 0, 0, $tid);
                     }
                 } elseif ($item['target'] instanceof entities\User) {
                     $uid = $item['target']->getID();
                     if (array_key_exists($uid, $al_users)) {
                         unset($i_al[$k]);
                     } elseif ($uid != $this->getUser()->getID()) {
                         framework\Context::removePermission('canviewissue', $issue->getID(), 'core', $uid, 0, 0);
                     }
                 }
             }
             foreach ($al_users as $uid) {
                 framework\Context::setPermission('canviewissue', $issue->getID(), 'core', $uid, 0, 0, true);
             }
             foreach ($al_teams as $tid) {
                 framework\Context::setPermission('canviewissue', $issue->getID(), 'core', 0, 0, $tid, true);
             }
         } catch (\Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('message' => framework\Context::getI18n()->__('This issue does not exist')));
         }
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('message' => framework\Context::getI18n()->__('This issue does not exist')));
     }
     return $this->renderJSON(array('message' => $this->getI18n()->__('Issue access policy updated')));
 }
开发者ID:AzerothShard,项目名称:thebuggenie,代码行数:54,代码来源:Main.php

示例8: addAssignee

 /**
  * Adds an assignee with a given role
  *
  * @param \thebuggenie\core\entities\common\Identifiable $assignee The user or team to add
  * @param Role $role The role to add
  *
  * @return null
  */
 public function addAssignee($assignee, $role = null)
 {
     $user_id = 0;
     $team_id = 0;
     if ($assignee instanceof \thebuggenie\core\entities\User) {
         $user_id = $assignee->getID();
         tables\ProjectAssignedUsers::getTable()->addUserToProject($this->getID(), $user_id, $role->getID());
     } elseif ($assignee instanceof \thebuggenie\core\entities\Team) {
         $team_id = $assignee->getID();
         tables\ProjectAssignedTeams::getTable()->addTeamToProject($this->getID(), $team_id, $role->getID());
     }
     if ($role instanceof \thebuggenie\core\entities\Role) {
         foreach ($role->getPermissions() as $role_permission) {
             $target_id = $role_permission->hasTargetID() ? $role_permission->getReplacedTargetID($this) : $this->getID();
             framework\Context::setPermission($role_permission->getPermission(), $target_id, $role_permission->getModule(), $user_id, 0, $team_id, true, null, $role->getID());
         }
     }
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:26,代码来源:Project.php


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