18 public static function canCreate(array $params = []): bool
20 $siteId = (string)($params[
'siteId'] ?? SITE_ID);
21 $checkAdminSession = (bool)($params[
'checkAdminSession'] ??
true);
24 \CSocNetUser::isCurrentUserModuleAdmin(SITE_ID, $checkAdminSession)
25 || (\CMain::getGroupRight(
'socialnetwork',
false,
'Y',
'Y', [ $siteId,
false ]) >=
'K')
29 public static function canView(array $params = []): bool
31 $groupId = (int)($params[
'groupId'] ?? 0);
32 $currentUserId = (int)($params[
'userId'] ??
Helper\User::getCurrentUserId());
33 $checkAdminSession = (bool)($params[
'checkAdminSession'] ??
true);
40 if ($currentUserId <= 0)
45 $group = WorkgroupTable::getList([
49 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID',
'VISIBLE' ],
56 $currentUserRelation = UserToGroupTable::getList([
58 '=GROUP_ID' => $groupId,
59 '=USER_ID' => $currentUserId,
61 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
70 'checkAdminSession' => $checkAdminSession,
74 return $accessManager->canView();
77 public static function canModify(array $params = []): bool
79 $groupId = (int)($params[
'groupId'] ?? 0);
80 $currentUserId = (int)($params[
'userId'] ??
Helper\User::getCurrentUserId());
81 $checkAdminSession = (bool)($params[
'checkAdminSession'] ??
true);
88 if ($currentUserId <= 0)
93 $group = WorkgroupTable::getList([
97 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
104 $currentUserRelation = UserToGroupTable::getList([
106 '=GROUP_ID' => $groupId,
107 '=USER_ID' => $currentUserId,
109 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
114 $currentUserRelation,
115 $currentUserRelation,
118 'checkAdminSession' => $checkAdminSession,
122 return $accessManager->canModify();
125 public static function canUpdate(array $params = []): bool
127 return static::canModify($params);
132 $groupId = (int)($params[
'groupId'] ?? 0);
133 $userId = (int)($params[
'userId'] ?? 0);
134 $currentUserId = Helper\User::getCurrentUserId();
139 || $currentUserId <= 0
145 $group = WorkgroupTable::getList([
149 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
156 $targetUserRelation = UserToGroupTable::getList([
158 '=GROUP_ID' => $groupId,
159 '=USER_ID' => $userId,
161 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
164 $currentUserRelation = UserToGroupTable::getList([
166 '=GROUP_ID' => $groupId,
167 '=USER_ID' => $currentUserId,
169 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
178 return $accessManager->canSetOwner();
183 $groupId = (int)($params[
'groupId'] ?? 0);
184 $userId = ($params[
'userId'] ??
null);
185 $currentUserId = Helper\User::getCurrentUserId();
190 || $currentUserId <= 0
196 $group = WorkgroupTable::getList([
200 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
207 $targetUserRelation = UserToGroupTable::getList([
209 '=GROUP_ID' => $groupId,
210 '=USER_ID' => $userId,
212 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
215 $currentUserRelation = UserToGroupTable::getList([
217 '=GROUP_ID' => $groupId,
218 '=USER_ID' => $currentUserId,
220 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
229 return $accessManager->canSetScrumMaster();
234 $groupId = (int)($params[
'groupId'] ?? 0);
235 $userId = ($params[
'userId'] ??
null);
236 $currentUserId = Helper\User::getCurrentUserId();
241 || $currentUserId <= 0
247 $group = WorkgroupTable::getList([
251 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID',
'INITIATE_PERMS' ],
258 $targetUserRelation = UserToGroupTable::getList([
260 '=GROUP_ID' => $groupId,
261 '=USER_ID' => $userId,
263 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID',
'INITIATED_BY_TYPE',
'INITIATED_BY_USER_ID' ],
266 $currentUserRelation = UserToGroupTable::getList([
268 '=GROUP_ID' => $groupId,
269 '=USER_ID' => $currentUserId,
271 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
280 return $accessManager->canDeleteOutgoingRequest();
285 $groupId = (int)($params[
'groupId'] ?? 0);
286 $userId = ($params[
'userId'] ??
null);
287 $currentUserId = Helper\User::getCurrentUserId();
292 || $currentUserId <= 0
298 $group = WorkgroupTable::getList([
302 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
309 $targetUserRelation = UserToGroupTable::getList([
311 '=GROUP_ID' => $groupId,
312 '=USER_ID' => $userId,
314 'select' => [
'ID',
'ROLE',
'GROUP_ID',
'INITIATED_BY_TYPE',
'INITIATED_BY_USER_ID' ],
317 $currentUserRelation = UserToGroupTable::getList([
319 '=GROUP_ID' => $groupId,
320 '=USER_ID' => $currentUserId,
322 'select' => [
'ID',
'GROUP_ID' ],
331 return $accessManager->canDeleteIncomingRequest();
336 $groupId = (int)($params[
'groupId'] ?? 0);
337 $userId = ($params[
'userId'] ??
null);
338 $currentUserId = Helper\User::getCurrentUserId();
343 || $currentUserId <= 0
349 $group = WorkgroupTable::getList([
353 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID',
'INITIATE_PERMS' ],
360 $targetUserRelation = UserToGroupTable::getList([
362 '=GROUP_ID' => $groupId,
363 '=USER_ID' => $userId,
365 'select' => [
'ID',
'ROLE',
'GROUP_ID',
'INITIATED_BY_TYPE' ],
368 $currentUserRelation = UserToGroupTable::getList([
370 '=GROUP_ID' => $groupId,
371 '=USER_ID' => $currentUserId,
373 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
382 return $accessManager->canProcessIncomingRequest();
387 $groupId = (int)($params[
'groupId'] ?? 0);
388 $userId = ($params[
'userId'] ??
null);
389 $currentUserId = Helper\User::getCurrentUserId();
391 $group = WorkgroupTable::getList([
395 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID',
'INITIATE_PERMS' ],
402 $targetUserRelation = UserToGroupTable::getList([
404 '=GROUP_ID' => $groupId,
405 '=USER_ID' => $userId,
407 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID',
'AUTO_MEMBER' ],
410 $currentUserRelation = UserToGroupTable::getList([
412 '=GROUP_ID' => $groupId,
413 '=USER_ID' => $currentUserId,
415 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
424 return $accessManager->canExclude();
427 public static function canJoin(array $params = []): bool
429 $groupId = (int)($params[
'groupId'] ?? 0);
430 $userId = ($params[
'userId'] ?? Helper\User::getCurrentUserId());
440 $group = WorkgroupTable::getList([
444 'select' => [
'ID',
'CLOSED',
'VISIBLE' ],
451 $currentUserRelation = UserToGroupTable::getList([
453 '=GROUP_ID' => $groupId,
454 '=USER_ID' => $userId,
456 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID',
'INITIATED_BY_TYPE' ],
465 return $accessManager->canJoin();
468 public static function canLeave(array $params = []): bool
470 $groupId = (int)($params[
'groupId'] ?? 0);
471 $userId = ($params[
'userId'] ?? Helper\User::getCurrentUserId());
481 $group = WorkgroupTable::getList([
485 'select' => [
'ID',
'PROJECT',
'SCRUM_MASTER_ID' ],
492 $currentUserRelation = UserToGroupTable::getList([
494 '=GROUP_ID' => $groupId,
495 '=USER_ID' => $userId,
497 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID',
'AUTO_MEMBER' ],
506 return $accessManager->canLeave();
511 $groupId = (int)($params[
'groupId'] ?? 0);
512 $userId = ($params[
'userId'] ??
null);
513 $currentUserId = Helper\User::getCurrentUserId();
518 || $currentUserId <= 0
524 $group = WorkgroupTable::getList([
528 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
535 $targetUserRelation = UserToGroupTable::getList([
537 '=GROUP_ID' => $groupId,
538 '=USER_ID' => $userId,
540 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
543 $currentUserRelation = UserToGroupTable::getList([
545 '=GROUP_ID' => $groupId,
546 '=USER_ID' => $currentUserId,
548 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
557 return $accessManager->canSetModerator();
562 $groupId = (int)($params[
'groupId'] ?? 0);
563 $userId = ($params[
'userId'] ??
null);
564 $currentUserId = Helper\User::getCurrentUserId();
569 || $currentUserId <= 0
575 $group = WorkgroupTable::getList([
579 'select' => [
'ID',
'CLOSED',
'PROJECT',
'SCRUM_MASTER_ID' ],
586 $targetUserRelation = UserToGroupTable::getList([
588 '=GROUP_ID' => $groupId,
589 '=USER_ID' => $userId,
591 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
594 $currentUserRelation = UserToGroupTable::getList([
596 '=GROUP_ID' => $groupId,
597 '=USER_ID' => $currentUserId,
599 'select' => [
'ID',
'ROLE',
'USER_ID',
'GROUP_ID' ],
608 return $accessManager->canRemoveModerator();
static canSetModerator(array $params=[])
static canView(array $params=[])
static canCreate(array $params=[])
static canJoin(array $params=[])
static canRemoveModerator(array $params=[])
static canSetOwner(array $params=[])
static canUpdate(array $params=[])
static canDeleteIncomingRequest(array $params=[])
static canSetScrumMaster(array $params=[])
static canModify(array $params=[])
static canExclude(array $params=[])
static canDeleteOutgoingRequest(array $params=[])
static canLeave(array $params=[])
static canProcessIncomingRequest(array $params=[])