コード例 #1
0
ファイル: Main.php プロジェクト: JonathanRH/thebuggenie
 public function runAddRole(framework\Request $request)
 {
     if ($this->getUser()->canManageProject($this->selected_project)) {
         if ($request['role_name']) {
             $role = new entities\Role();
             $role->setName($request['role_name']);
             $role->setProject($this->selected_project);
             $role->save();
             return $this->renderJSON(array('content' => $this->getComponentHTML('configuration/role', array('role' => $role))));
         }
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('message' => $this->getI18n()->__('You must provide a role name')));
     }
     $this->getResponse()->setHttpStatus(400);
     return $this->renderJSON(array('message' => $this->getI18n()->__('You do not have access to create new project roles')));
 }
コード例 #2
0
ファイル: Main.php プロジェクト: nrensen/thebuggenie
 public function runConfigureRoles(framework\Request $request)
 {
     if ($request->isPost()) {
         if (trim($request['role_name']) == '') {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('error' => $this->getI18n()->__('You have to specify a name for this role')));
         }
         $role = new entities\Role();
         $role->setName($request['role_name']);
         $role->save();
         return $this->renderJSON(array('content' => $this->getComponentHTML('configuration/role', array('role' => $role))));
     }
     $this->roles = entities\Role::getAll();
 }