protected function canUserRemove($user) { if ($user->id == $this->agent->getOwnerUser()->id) { return true; } else { if ($this->hasControl) { return $this->owner->canUser('removeAgentRelationWithControl', $user); } else { return $this->owner->canUser('removeAgentRelation', $user); } } }
protected function canUserRemove($user) { $app = App::i(); $agent_control = $app->isWorkflowEnabled() && $this->agent->canUser('@control', $user); if ($user->id == $this->agent->getOwnerUser()->id) { return true; } else { if ($this->hasControl) { return $this->owner->canUser('removeAgentRelationWithControl', $user) || $agent_control; } else { return $this->owner->canUser('removeAgentRelation', $user) || $agent_control; } } }