/** * Delete group * * @param void * @return null */ function delete() { if (!can_manage_security(logged_user())) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } // if $group = Groups::findById(get_id()); if (!$group instanceof Group) { flash_error(lang('group dnx')); ajx_current("empty"); return; } // if try { DB::beginWork(); $group->delete(); ApplicationLogs::createLog($group, null, ApplicationLogs::ACTION_DELETE); DB::commit(); flash_success(lang('success delete group', $group->getName())); ajx_current("reload"); } catch (Exception $e) { DB::rollback(); flash_error(lang('error delete group')); ajx_current("empty"); } // try }
function getUserOrGroup() { if ($this->getUserId() < Group::CONST_MINIMUM_GROUP_ID) { // it's a user if (!$this->user_or_group instanceof User) { $this->user_or_group = Users::findById($this->getUserId()); } } else { // it's a group if (!$this->user_or_group instanceof Group) { $this->user_or_group = Groups::findById($this->getUserId()); } } return $this->user_or_group; }