예제 #1
0
 /**
  * New group 
  * 
  * @param Request $r
  */
 public static function apiCreate(Request $r)
 {
     self::authenticateRequest($r);
     Validators::isValidAlias($r["alias"], "alias", true);
     Validators::isStringNonEmpty($r["name"], "name", true);
     Validators::isStringNonEmpty($r["description"], "description", false);
     try {
         $group = new Groups(array("owner_id" => $r["current_user_id"], "name" => $r["name"], "description" => $r["description"], "alias" => $r["alias"], "create_time" => gmdate('Y-m-d H:i:s', time())));
         GroupsDAO::save($group);
         self::$log->info("Group " . $r["alias"] . " created.");
     } catch (Exception $e) {
         throw new InvalidDatabaseOperationException($e);
     }
     return array("status" => "ok");
 }
예제 #2
0
 /**
  * New group
  *
  * @param Request $r
  */
 public static function apiCreate(Request $r)
 {
     self::authenticateRequest($r);
     Validators::isValidAlias($r['alias'], 'alias', true);
     Validators::isStringNonEmpty($r['name'], 'name', true);
     Validators::isStringNonEmpty($r['description'], 'description', false);
     try {
         $group = new Groups(array('owner_id' => $r['current_user_id'], 'name' => $r['name'], 'description' => $r['description'], 'alias' => $r['alias'], 'create_time' => gmdate('Y-m-d H:i:s', time())));
         GroupsDAO::save($group);
         self::$log->info('Group ' . $r['alias'] . ' created.');
     } catch (Exception $e) {
         throw new InvalidDatabaseOperationException($e);
     }
     return array('status' => 'ok');
 }