src/Sulu/Component/Security/Authorization/AccessControl/AccessControlManager.php
private function getUserRoleSecurityContextPermission(
        $locale,
        $securityContext,
        UserRole $userRole,
        $checkPermissionType
    ) {
        $userPermission = $this->maskConverter->convertPermissionsToArray(0);

        foreach ($userRole->getRole()->getPermissions() as $permission) {
            $hasContext = $permission->getContext() == $securityContext;

            if (!$hasContext) {
                continue;
            }

            $hasLocale = null == $locale || in_array($locale, $userRole->getLocales());

            if (!$hasLocale) {
                continue;
            }

            if ($checkPermissionType) {
                $userPermission = $this->maskConverter->convertPermissionsToArray($permission->getPermissions());
            } else {
                array_walk($userPermission, function(&$permission) {
                    $permission = true;
                });
            }
        }

        return $userPermission;
    }
private function getUserRoleSecurityContextPermission(
        $locale,
        $securityContext,
        UserRole $userRole,
        $checkPermissionType
    ) {
        $userPermission = $this->maskConverter->convertPermissionsToArray(0);

        foreach ($userRole->getRole()->getPermissions() as $permission) {
            $hasContext = $permission->getContext() == $securityContext;

            if (!$hasContext) {
                continue;
            }

            $hasLocale = null == $locale || in_array($locale, $userRole->getLocales());

            if (!$hasLocale) {
                continue;
            }

            if ($checkPermissionType) {
                $userPermission = $this->maskConverter->convertPermissionsToArray($permission->getPermissions());
            } else {
                array_walk($userPermission, function(&$permission) {
                    $permission = true;
                });
            }
        }

        return $userPermission;
    }
private function getUserRoleSecurityContextPermission ( $ locale , $ securityContext , UserRole $ userRole , $ checkPermissionType ) { $ userPermission = $ this -> maskConverter -> convertPermissionsToArray ( 0 ) ; foreach ( $ userRole -> getRole ( ) -> getPermissions ( ) as $ permission ) { $ hasContext = $ permission -> getContext ( ) == $ securityContext ; if ( ! $ hasContext ) { continue ; } $ hasLocale = null == $ locale || in_array ( $ locale , $ userRole -> getLocales ( ) ) ; if ( ! $ hasLocale ) { continue ; } if ( $ checkPermissionType ) { $ userPermission = $ this -> maskConverter -> convertPermissionsToArray ( $ permission -> getPermissions ( ) ) ; } else { array_walk ( $ userPermission , function ( & $ permission ) { $ permission = true ; } ) ; } } return $ userPermission ; }
Returns the permissions for the given security context for the given user role.

@param string $locale
@param string $securityContext
@param UserRole $userRole The user role for which the security is checked
@param bool $checkPermissionType Flag to show if the permission type should also be checked

@return array
Returns the permissions for the given security context for the given user role .