public function FarmRemoveRole($FarmID, $FarmRoleID) { try { $DBFarm = DBFarm::LoadByID($FarmID); if ($DBFarm->EnvID != $this->Environment->id) { throw new Exception("N"); } } catch (Exception $e) { throw new Exception(sprintf("Farm #%s not found", $FarmID)); } $this->user->getPermissions()->validate($DBFarm); $this->restrictFarmAccess($DBFarm, Acl::PERM_FARMS_UPDATE); $DBFarm->isLocked(true); try { $DBFarmRole = DBFarmRole::LoadByID($FarmRoleID); if ($DBFarm->ID != $DBFarmRole->FarmID) { throw new Exception("N"); } } catch (Exception $e) { throw new Exception(sprintf("FarmRole ID #%s not found", $FarmRoleID)); } $this->user->getPermissions()->validate($DBFarm); $farmRole = new Entity\FarmRole(); $farmRole->id = $FarmRoleID; $farmRole->delete(); $response = $this->CreateInitialResponse(); $response->Result = true; return $response; }