20 $currentUserId = $USER->getId();
21 $isCurrentUserAdmin = \CSocNetUser::isCurrentUserModuleAdmin();
22 $entityType = ($params[
'ENTITY_TYPE'] ?? SONET_ENTITY_USER);
23 $entityId = (int)($params[
'ENTITY_ID'] ?? 0);
28 !Loader::includeModule(
'forum')
29 || !in_array($entityType, [ SONET_ENTITY_GROUP, SONET_ENTITY_USER ],
true)
35 $result = Permission::ACCESS_DENIED;
37 if (\CSocNetFeaturesPerms::canPerformOperation($currentUserId, $entityType, $entityId,
'forum',
'full', $isCurrentUserAdmin))
39 $result = Permission::FULL_ACCESS;
41 elseif (\CSocNetFeaturesPerms::CanPerformOperation($currentUserId, $entityType, $entityId,
'forum',
'newtopic', $isCurrentUserAdmin))
43 $result = Permission::CAN_ADD_TOPIC;
45 elseif (\CSocNetFeaturesPerms::CanPerformOperation($currentUserId, $entityType, $entityId,
'forum',
'answer', $isCurrentUserAdmin))
47 $result = Permission::CAN_ADD_MESSAGE;
49 elseif (\CSocNetFeaturesPerms::CanPerformOperation($currentUserId, $entityType, $entityId,
'forum',
'view', $isCurrentUserAdmin))
51 $result = Permission::CAN_READ;