Exemplo n.º 1
0
 /**
  * @url GET resource/{concept}
  * @param string $concept
  * @param array $roleIds
  */
 public function getConceptAtoms($concept, $roleIds = null)
 {
     try {
         $session = Session::singleton();
         $session->activateRoles($roleIds);
         if (!in_array($concept, $session->getEditableConcepts())) {
             throw new Exception("You do not have access for this call", 403);
         }
         return Concept::getAllAtomObjects($concept);
         // "Return list of all atoms for $concept"
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * @url GET resource/{concept}
  */
 public function getConceptAtoms($concept)
 {
     try {
         // If login is enabled, check if users may request all atoms.
         if (Config::get('loginEnabled')) {
             $editableConcepts = array();
             $roles = Role::getAllSessionRoles();
             foreach ($roles as $role) {
                 $editableConcepts = array_merge($editableConcepts, $role->editableConcepts);
             }
             if (!in_array($concept, $editableConcepts)) {
                 throw new Exception("You do not have access for this call", 403);
             }
         }
         return Concept::getAllAtomObjects($concept);
         // "Return list of all atoms for $concept"
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }