36 $this->controller->addError(static::class,
'Wrong instance');
41 if ($this->user->isAdmin())
46 if ($this->user->getUserId() === $item->getOwnerId())
52 if (empty($canInvite))
54 $this->controller->addError(
56 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED')
62 if ($canInvite === UserRole::EMPLOYEE)
64 if (!$this->user->isIntranet())
66 $this->controller->addError(
68 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED')
74 if (!$this->user->isMember($item->getId()))
76 $this->controller->addError(
78 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED')
87 $userRole = $this->getUserRole($item->getId(), $this->user->getUserId());
91 $this->controller->addError(
93 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED')
99 if ($userRole > $canInvite)
101 $this->controller->addError(
103 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED')
109 if ($this->canInvite($this->user, $item))
114 $this->controller->addError(
116 Loc::getMessage(
'SOCIALNETWORK_COLLAB_INVITE_RULE_PERMISSION_DENIED_BY_USERS')