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


PHP TBGContext::setPermission方法代码示例

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


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

示例1: _postSave

 public function _postSave($is_new)
 {
     if ($is_new) {
         TBGContext::setPermission("canseecomponent", $this->getID(), "core", 0, TBGContext::getUser()->getGroup()->getID(), 0, true);
         TBGEvent::createNew('core', 'TBGComponent::createNew', $this)->trigger();
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:7,代码来源:TBGComponent.class.php

示例2: loadFixtures

 public static function loadFixtures(TBGScope $scope)
 {
     TBGCategory::loadFixtures($scope);
     TBGPriority::loadFixtures($scope);
     TBGReproducability::loadFixtures($scope);
     TBGResolution::loadFixtures($scope);
     TBGSeverity::loadFixtures($scope);
     TBGStatus::loadFixtures($scope);
     TBGRole::loadFixtures($scope);
     TBGActivityType::loadFixtures($scope);
     foreach (self::getTypes() as $type => $class) {
         TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:14,代码来源:TBGDatatype.class.php

示例3: runSetPermission

 public function runSetPermission(TBGRequest $request)
 {
     $i18n = TBGContext::getI18n();
     if ($this->access_level == TBGSettings::ACCESS_FULL) {
         $uid = 0;
         $gid = 0;
         $tid = 0;
         switch ($request->getParameter('target_type')) {
             case 'user':
                 $uid = $request->getParameter('item_id');
                 break;
             case 'group':
                 $gid = $request->getParameter('item_id');
                 break;
             case 'team':
                 $tid = $request->getParameter('item_id');
                 break;
         }
         switch ($request->getParameter('mode')) {
             case 'allowed':
                 TBGContext::setPermission($request->getParameter('key'), $request->getParameter('target_id'), $request->getParameter('target_module'), $uid, $gid, $tid, true);
                 break;
             case 'denied':
                 TBGContext::setPermission($request->getParameter('key'), $request->getParameter('target_id'), $request->getParameter('target_module'), $uid, $gid, $tid, false);
                 break;
             case 'unset':
                 TBGContext::removePermission($request->getParameter('key'), $request->getParameter('target_id'), $request->getParameter('target_module'), $uid, $gid, $tid);
                 break;
         }
         return $this->renderJSON(array('failed' => false, 'content' => $this->getComponentHTML('configuration/permissionsinfoitem', array('key' => $request->getParameter('key'), 'target_id' => $request->getParameter('target_id'), 'type' => $request->getParameter('target_type'), 'mode' => $request->getParameter('template_mode'), 'item_id' => $request->getParameter('item_id'), 'module' => $request->getParameter('target_module'), 'access_level' => $this->access_level))));
     }
     return $this->renderJSON(array('failed' => true, "error" => $i18n->__("You don't have access to modify permissions")));
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:33,代码来源:actions.class.php

示例4: _postSave

 public function _postSave($is_new)
 {
     if ($is_new) {
         self::$_num_projects = null;
         self::$_projects = null;
         TBGContext::setPermission("canseeproject", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canseeprojecthierarchy", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canmanageproject", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("page_project_allpages_access", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canvoteforissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canlockandeditlockedissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("cancreateandeditissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("caneditissue", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("caneditissuecustomfields", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canaddextrainformationtoissues", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGContext::setPermission("canpostseeandeditallcomments", $this->getID(), "core", TBGContext::getUser()->getID(), 0, 0, true);
         TBGEvent::createNew('core', 'TBGProject::createNew', $this)->trigger();
     }
     if ($this->_dodelete) {
         TBGIssuesTable::getTable()->markIssuesDeletedByProjectID($this->getID());
         $this->_dodelete = false;
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:23,代码来源:TBGProject.class.php

示例5: _loadFixtures

 protected function _loadFixtures($scope)
 {
     $this->loadFixturesArticles($scope);
     TBGLinksTable::getTable()->addLink('wiki', 0, 'MainPage', 'Wiki Frontpage', 1, $scope);
     TBGLinksTable::getTable()->addLink('wiki', 0, 'WikiFormatting', 'Formatting help', 2, $scope);
     TBGLinksTable::getTable()->addLink('wiki', 0, 'Category:Help', 'Help topics', 3, $scope);
     TBGContext::setPermission('editarticle', 0, 'publish', 0, 1, 0, true, $scope);
     TBGContext::setPermission('deletearticle', 0, 'publish', 0, 1, 0, true, $scope);
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:9,代码来源:TBGPublish.class.php

示例6: _postSave

 protected function _postSave($is_new)
 {
     if ($is_new) {
         TBGContext::setPermission("canseemilestone", $this->getID(), "core", 0, TBGContext::getUser()->getGroup()->getID(), 0, true);
         TBGEvent::createNew('core', 'TBGMilestone::_postSave', $this)->trigger();
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:7,代码来源:TBGMilestone.class.php

示例7: runLockIssue

 /**
  * Unlock the issue
  * 
  * @param TBGRequest $request
  */
 public function runLockIssue(TBGRequest $request)
 {
     if ($issue_id = $request['issue_id']) {
         try {
             $issue = TBGContext::factory()->TBGIssue($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();
             TBGContext::setPermission('canviewissue', $issue->getID(), 'core', 0, 0, 0, false);
             TBGContext::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 TBGTeam) {
                     $tid = $item['target']->getID();
                     if (array_key_exists($tid, $al_teams)) {
                         unset($i_al[$k]);
                     } else {
                         TBGContext::removePermission('canviewissue', $issue->getID(), 'core', 0, 0, $tid);
                     }
                 } elseif ($item['target'] instanceof TBGUser) {
                     $uid = $item['target']->getID();
                     if (array_key_exists($uid, $al_users)) {
                         unset($i_al[$k]);
                     } elseif ($uid != $this->getUser()->getID()) {
                         TBGContext::removePermission('canviewissue', $issue->getID(), 'core', $uid, 0, 0);
                     }
                 }
             }
             foreach ($al_users as $uid) {
                 TBGContext::setPermission('canviewissue', $issue->getID(), 'core', $uid, 0, 0, true);
             }
             foreach ($al_teams as $tid) {
                 TBGContext::setPermission('canviewissue', $issue->getID(), 'core', 0, 0, $tid, true);
             }
         } catch (Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('message' => TBGContext::getI18n()->__('This issue does not exist')));
         }
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('message' => TBGContext::getI18n()->__('This issue does not exist')));
     }
     return $this->renderJSON(array('message' => $this->getI18n()->__('Issue access policy updated')));
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:54,代码来源:actions.class.php

示例8: _upgradeFrom3dot1

 protected function _upgradeFrom3dot1()
 {
     // Add classpath for existing old tables used for upgrade
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.1');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes');
     // Create new tables
     TBGDashboardViewsTable::getTable()->create();
     TBGOpenIdAccountsTable::getTable()->create();
     TBGProjectAssignedUsersTable::getTable()->create();
     TBGProjectAssignedTeamsTable::getTable()->create();
     TBGEditionAssignedUsersTable::getTable()->create();
     TBGEditionAssignedTeamsTable::getTable()->create();
     TBGComponentAssignedUsersTable::getTable()->create();
     TBGComponentAssignedTeamsTable::getTable()->create();
     TBGRolePermissionsTable::getTable()->create();
     TBGUserScopesTable::getTable()->create();
     // Upgrade existing tables
     TBGProjectsTable::getTable()->upgrade(TBGProjectsTable3dot1::getTable());
     TBGUsersTable::getTable()->upgrade(TBGUsersTable3dot1::getTable());
     TBGIssuesTable::getTable()->upgrade(TBGIssuesTable3dot1::getTable());
     TBGIssueTypesTable::getTable()->upgrade(TBGIssueTypesTable3dot1::getTable());
     TBGListTypesTable::getTable()->upgrade(TBGListTypesTable3dot1::getTable());
     TBGEditionsTable::getTable()->upgrade(TBGEditionsTable3dot1::getTable());
     TBGBuildsTable::getTable()->upgrade(TBGBuildsTable3dot1::getTable());
     TBGCommentsTable::getTable()->upgrade(TBGCommentsTable3dot1::getTable());
     TBGComponentsTable::getTable()->upgrade(TBGComponentsTable3dot1::getTable());
     TBGCustomFieldsTable::getTable()->upgrade(TBGCustomFieldsTable3dot1::getTable());
     TBGCustomFieldOptionsTable::getTable()->upgrade(TBGCustomFieldOptionsTable3dot1::getTable());
     TBGIssueCustomFieldsTable::getTable()->upgrade(TBGIssueCustomFieldsTable3dot1::getTable());
     // Create new module tables
     TBGIncomingEmailAccountTable::getTable()->create();
     // Add new indexes
     TBGArticlesTable::getTable()->createIndexes();
     TBGCommentsTable::getTable()->createIndexes();
     TBGIssueAffectsBuildTable::getTable()->createIndexes();
     TBGIssueAffectsComponentTable::getTable()->createIndexes();
     TBGIssueAffectsEditionTable::getTable()->createIndexes();
     TBGIssueFieldsTable::getTable()->createIndexes();
     TBGIssueFilesTable::getTable()->createIndexes();
     TBGIssuesTable::getTable()->createIndexes();
     TBGIssuetypeSchemesTable::getTable()->createIndexes();
     TBGPermissionsTable::getTable()->createIndexes();
     TBGProjectsTable::getTable()->createIndexes();
     TBGSettingsTable::getTable()->createIndexes();
     TBGTeamMembersTable::getTable()->createIndexes();
     TBGUserIssuesTable::getTable()->createIndexes();
     TBGUsersTable::getTable()->createIndexes();
     TBGUserScopesTable::getTable()->createIndexes();
     if (TBGContext::getRequest()->getParameter('fix_my_timestamps', false)) {
         $this->_fixTimestamps();
     }
     foreach (TBGScope::getAll() as $scope) {
         TBGRole::loadFixtures($scope);
         foreach (TBGDatatype::getTypes() as $type => $class) {
             TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
         }
         TBGContext::setPermission('page_confirm_scope_access', 0, 'core', 0, 0, 0, true, $scope->getID());
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOW, 'core', $scope->getID())) {
             $workflow_id = TBGWorkflowsTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOW, $workflow_id, 'core', $scope->getID());
             } else {
                 TBGWorkflow::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, 'core', $scope->getID())) {
             $workflow_scheme_id = TBGWorkflowSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, $workflow_scheme_id, 'core', $scope->getID());
             } else {
                 TBGWorkflowScheme::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, 'core', $scope->getID())) {
             $issuetype_scheme_id = TBGIssuetypeSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($issuetype_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, $issuetype_scheme_id, 'core', $scope->getID());
             } else {
                 TBGIssuetypeScheme::loadFixtures($scope);
             }
         }
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, 0, 'core', $scope->getID());
     }
     $linkstable = TBGLinksTable::getTable();
     $crit = $linkstable->getCriteria();
     $crit->addUpdate(TBGLinksTable::URL, 'http://issues.thebuggenie.com');
     $crit->addWhere(TBGLinksTable::URL, 'http://thebuggenie.com/thebuggenie');
     $crit->addOr(TBGLinksTable::URL, 'http://www.thebuggenie.com/thebuggenie');
     $linkstable->doUpdate($crit);
     $listtypestable = TBGListTypesTable::getTable();
     $crit = $listtypestable->getCriteria();
     $crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'role');
     $crit->addWhere(TBGListTypesTable::ITEMTYPE, 'projectrole');
     $listtypestable->doUpdate($crit);
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:actions.class.php

示例9: applyInitialPermissionSet

 public function applyInitialPermissionSet(TBGIdentifiable $identifiable, $type)
 {
     $permission_set = TBGContext::getProjectAssigneeDefaultPermissionSet($this, $type);
     $uid = $identifiable->getType() == TBGIdentifiableClass::TYPE_USER ? $identifiable->getID() : null;
     $tid = $identifiable->getType() == TBGIdentifiableClass::TYPE_TEAM ? $identifiable->getID() : null;
     foreach ($permission_set as $permission) {
         TBGContext::setPermission($permission, $this->getID(), 'core', $uid, null, $tid, true);
     }
     if (!$this instanceof TBGProject) {
         $extrapermissions = array();
         $extrapermissions[] = 'page_project_allpages_access';
         $extrapermissions[] = 'canseeproject';
         $extrapermissions[] = 'canseeprojecthierarchy';
         $extrapermissions[] = 'cancreateandeditissues';
         $extrapermissions[] = 'canpostandeditcomments';
         $project_id = $this->getProject()->getID();
         foreach ($extrapermissions as $permission) {
             TBGContext::setPermission($permission, $project_id, 'core', $uid, null, $tid, true);
         }
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:21,代码来源:TBGOwnableItem.class.php

示例10: addAssignee

 /**
  * Adds an assignee with a given role
  * 
  * @param TBGIdentifiable $assignee The user or team to add
  * @param integer $role The role to add
  *  
  * @return null
  */
 public function addAssignee($assignee, $role = null)
 {
     $user_id = 0;
     $team_id = 0;
     if ($assignee instanceof TBGUser) {
         $user_id = $assignee->getID();
         TBGProjectAssignedUsersTable::getTable()->addUserToProject($this->getID(), $user_id, $role->getID());
     } elseif ($assignee instanceof TBGTeam) {
         $team_id = $assignee->getID();
         TBGProjectAssignedTeamsTable::getTable()->addTeamToProject($this->getID(), $team_id, $role->getID());
     }
     if ($role instanceof TBGRole) {
         foreach ($role->getPermissions() as $role_permission) {
             $target_id = $role_permission->hasTargetID() ? $role_permission->getReplacedTargetID($this) : $this->getID();
             TBGContext::setPermission($role_permission->getPermission(), $target_id, $role_permission->getModule(), $user_id, 0, $team_id, true, null, $role->getID());
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:26,代码来源:TBGProject.class.php

示例11: _loadFixtures

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


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