Identity/OrganizationSecurityIdentity.php
protected static function getSecurityIdentityForAllOrganizations(UserInterface $user, $roleHierarchy = null)
    {
        $sids = [];

        if ($user instanceof UserOrganizationUsersInterface) {
            foreach ($user->getUserOrganizations() as $userOrg) {
                $sids[] = self::fromAccount($userOrg->getOrganization());
                $sids = array_merge($sids, static::getOrganizationGroups($userOrg));
                $roles = static::getOrganizationUserRoles($userOrg, $roleHierarchy);

                foreach ($roles as $role) {
                    $sids[] = RoleSecurityIdentity::fromAccount($role);
                }
            }
        }

        return $sids;
    }
protected static function getSecurityIdentityForAllOrganizations(UserInterface $user, $roleHierarchy = null)
    {
        $sids = [];

        if ($user instanceof UserOrganizationUsersInterface) {
            foreach ($user->getUserOrganizations() as $userOrg) {
                $sids[] = self::fromAccount($userOrg->getOrganization());
                $sids = array_merge($sids, static::getOrganizationGroups($userOrg));
                $roles = static::getOrganizationUserRoles($userOrg, $roleHierarchy);

                foreach ($roles as $role) {
                    $sids[] = RoleSecurityIdentity::fromAccount($role);
                }
            }
        }

        return $sids;
    }
protected static function getSecurityIdentityForAllOrganizations ( UserInterface $ user , $ roleHierarchy = null ) { $ sids = [ ] ; if ( $ user instanceof UserOrganizationUsersInterface ) { foreach ( $ user -> getUserOrganizations ( ) as $ userOrg ) { $ sids [ ] = self :: fromAccount ( $ userOrg -> getOrganization ( ) ) ; $ sids = array_merge ( $ sids , static :: getOrganizationGroups ( $ userOrg ) ) ; $ roles = static :: getOrganizationUserRoles ( $ userOrg , $ roleHierarchy ) ; foreach ( $ roles as $ role ) { $ sids [ ] = RoleSecurityIdentity :: fromAccount ( $ role ) ; } } } return $ sids ; }
Get the security identities for all organizations of user.

@param UserInterface               $user          The user
@param null|RoleHierarchyInterface $roleHierarchy The role hierarchy

@return SecurityIdentityInterface[]
Get the security identities for all organizations of user .