Пример #1
0
 public function itRevokesPermissions()
 {
     $request = aRequest()->with(Tracker_Permission_Command::PERMISSION_PREFIX . ProjectUGroup::ANONYMOUS, Tracker_Permission_Command::PERMISSION_SUBMITTER_ONLY)->with(Tracker_Permission_Command::PERMISSION_PREFIX . ProjectUGroup::REGISTERED, Tracker_Permission_Command::PERMISSION_FULL)->build();
     $set_permission_request = new Tracker_Permission_PermissionRequest(array());
     $set_permission_request->setFromRequest($request, $this->minimal_ugroup_list);
     $set_permission_request->revoke(ProjectUGroup::REGISTERED);
     $this->assertNull($set_permission_request->getPermissionType(ProjectUGroup::REGISTERED));
 }
 private function save(Codendi_Request $request)
 {
     $permission_setter = $this->getPermissionSetter();
     $permission_request = new Tracker_Permission_PermissionRequest(array());
     $permission_request->setFromRequest($request, $permission_setter->getAllGroupIds());
     $permission_manager = new Tracker_Permission_PermissionManager();
     $permission_manager->save($permission_request, $permission_setter);
     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId() . '&func=admin-perms-tracker');
 }
Пример #3
0
 public function apply(Tracker_Permission_PermissionRequest $request, Tracker_Permission_PermissionSetter $permission_setter)
 {
     foreach ($permission_setter->getAllGroupIds() as $ugroup_id) {
         if ($this->ugroupHasOwnCommand($ugroup_id)) {
             continue;
         }
         $this->adjustPermissionsForGroup($permission_setter, $ugroup_id, $request->getPermissionType($ugroup_id));
     }
     $this->applyNextCommand($request, $permission_setter);
 }
 private function checkPermissionValidity(Tracker_Permission_PermissionRequest $request, Tracker $tracker)
 {
     if ($request->containsPermissionType(Tracker_Permission_Command::PERMISSION_ASSIGNEE) != null && $tracker->getContributorField() === null) {
         $GLOBALS['Response']->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('plugin_tracker_admin_permissions', 'no_assignee_semantic', array(TRACKER_BASE_URL . '/?' . http_build_query(array('func' => 'admin-semantic', 'tracker' => $tracker->getId())), $GLOBALS['Language']->getText('plugin_tracker_admin_semantic', 'contributor_label'))), CODENDI_PURIFIER_DISABLED);
         return false;
     }
     if ($request->getPermissionType(ProjectUGroup::PROJECT_ADMIN)) {
         return false;
     }
     return true;
 }
Пример #5
0
 public function apply(Tracker_Permission_PermissionRequest $request, Tracker_Permission_PermissionSetter $permission_setter)
 {
     switch ($request->getPermissionType(ProjectUGroup::ANONYMOUS)) {
         case Tracker_Permission_Command::PERMISSION_FULL:
             $permission_setter->grantAccess(Tracker::PERMISSION_FULL, ProjectUGroup::ANONYMOUS);
             foreach ($permission_setter->getAllGroupIds() as $stored_ugroup_id) {
                 if ($stored_ugroup_id !== ProjectUGroup::ANONYMOUS) {
                     $this->revokeAllButAdmin($request, $permission_setter, $stored_ugroup_id);
                 }
             }
             break;
         case Tracker_Permission_Command::PERMISSION_NONE:
             $permission_setter->revokeAll(ProjectUGroup::ANONYMOUS);
             break;
     }
     $this->applyNextCommand($request, $permission_setter);
 }
Пример #6
0
 private function requestContainsNonAdminPermissions(Tracker_Permission_PermissionRequest $request, $ugroup_id)
 {
     return in_array($request->getPermissionType($ugroup_id), self::$non_admin_permissions);
 }