/** * * @param string $name * @return Scalr_Account_Group */ public function createTeam($name) { if (!$this->id) { throw new Exception("Account is not created"); } $group = Scalr_Account_Group::init(); $group->accountId = $this->id; $group->name = $name; $group->isActive = 1; return $group->save(); }
public function xRemovePermissionGroupAction() { $team = Scalr_Account_Team::init()->loadById($this->getParam(self::CALL_PARAM_NAME)); $this->user->getPermissions()->validate($team); if (!($this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER || $team->isTeamOwner($this->user->getId()))) { throw new Scalr_Exception_InsufficientPermissions(); } $group = Scalr_Account_Group::init(); $group->loadById($this->getParam('groupId')); if ($group->teamId != $team->id) { throw new Scalr_Exception_InsufficientPermissions(); } $group->delete(); $this->response->success(); }