/** * Add user to group * * @param Request $r */ public static function apiAddUser(Request $r) { self::validateGroupAndOwner($r); $r["user"] = UserController::resolveUser($r["usernameOrEmail"]); try { $groups_user = new GroupsUsers(array("group_id" => $r["group"]->group_id, "user_id" => $r["user"]->user_id)); GroupsUsersDAO::save($groups_user); } catch (Exception $ex) { throw new InvalidDatabaseOperationException($ex); } return array("status" => "ok"); }
/** * Add user to group * * @param Request $r */ public static function apiAddUser(Request $r) { self::validateGroupAndOwner($r); $r['user'] = UserController::resolveUser($r['usernameOrEmail']); try { $groups_user = new GroupsUsers(array('group_id' => $r['group']->group_id, 'user_id' => $r['user']->user_id)); GroupsUsersDAO::save($groups_user); } catch (Exception $ex) { throw new InvalidDatabaseOperationException($ex); } return array('status' => 'ok'); }