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


PHP Tracker::getPermissionsByUgroupId方法代码示例

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


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

示例1: userCanViewTracker

 public function userCanViewTracker(PFUser $user, Tracker $tracker)
 {
     if ($user->isSuperUser()) {
         return true;
     }
     if ($tracker->userIsAdmin($user)) {
         return true;
     }
     $project = $tracker->getProject();
     if ($this->userIsRestrictedAndNotMemberOfProject($user, $project) || $this->userIsNotMemberOfPrivateProject($user, $project)) {
         return false;
     }
     foreach ($tracker->getPermissionsByUgroupId() as $ugroup_id => $permission_types) {
         if ($user->isMemberOfUGroup($ugroup_id, $tracker->getGroupId())) {
             return true;
         }
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:19,代码来源:PermissionChecker.class.php

示例2: saveObject

 /**
  * Saves a Tracker object into the DataBase
  *
  * @param Tracker $tracker object to save
  * @return int id of the newly created tracker
  */
 public function saveObject($tracker)
 {
     // create tracker
     $this->getDao()->startTransaction();
     $tracker_id = $this->getDao()->create($tracker->group_id, $tracker->name, $tracker->description, $tracker->item_name, $tracker->allow_copy, $tracker->submit_instructions, $tracker->browse_instructions, '', '', $tracker->instantiate_for_new_projects, $tracker->log_priority_changes, $tracker->stop_notification, $tracker->color, $tracker->isEmailgatewayEnabled());
     if ($tracker_id) {
         $trackerDB = $this->getTrackerById($tracker_id);
         //create cannedResponses
         $response_factory = $tracker->getCannedResponseFactory();
         foreach ($tracker->cannedResponses as $response) {
             $response_factory->saveObject($tracker_id, $response);
         }
         //create formElements
         foreach ($tracker->formElements as $formElement) {
             // these fields have no parent
             Tracker_FormElementFactory::instance()->saveObject($trackerDB, $formElement, 0);
         }
         //create report
         foreach ($tracker->reports as $report) {
             Tracker_ReportFactory::instance()->saveObject($tracker_id, $report);
         }
         //create semantics
         if (isset($tracker->semantics)) {
             foreach ($tracker->semantics as $semantic) {
                 Tracker_SemanticFactory::instance()->saveObject($semantic, $trackerDB);
             }
         }
         //create rules
         if (isset($tracker->rules)) {
             $this->getRuleFactory()->saveObject($tracker->rules, $trackerDB);
         }
         //create workflow
         if (isset($tracker->workflow)) {
             WorkflowFactory::instance()->saveObject($tracker->workflow, $trackerDB);
         }
         //tracker permissions
         if ($tracker->permissionsAreCached()) {
             $pm = PermissionsManager::instance();
             foreach ($tracker->getPermissionsByUgroupId() as $ugroup => $permissions) {
                 foreach ($permissions as $permission) {
                     $pm->addPermission($permission, $tracker_id, $ugroup);
                 }
             }
         } else {
             $this->saveTrackerDefaultPermission($tracker_id);
         }
         $this->postCreateActions($trackerDB);
     }
     $this->getDao()->commit();
     return $tracker_id;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:57,代码来源:TrackerFactory.class.php


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