Identity/OrganizationSecurityIdentity.php
protected static function getSecurityIdentityForCurrentOrganization(
        OrganizationalContextInterface $context,
        $roleHierarchy = null
    ) {
        $sids = [];
        $org = $context->getCurrentOrganization();
        $userOrg = $context->getCurrentOrganizationUser();
        $orgRoles = [];

        if ($org) {
            $sids[] = self::fromAccount($org);
        }

        if (null !== $userOrg) {
            $sids = array_merge($sids, static::getOrganizationGroups($userOrg));
            $orgRoles = static::getOrganizationUserRoles($userOrg, $roleHierarchy);
        } elseif ($org && $org->isUserOrganization()) {
            $orgRoles = static::getOrganizationRoles($org, $roleHierarchy);
        }

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

        return $sids;
    }
protected static function getSecurityIdentityForCurrentOrganization(
        OrganizationalContextInterface $context,
        $roleHierarchy = null
    ) {
        $sids = [];
        $org = $context->getCurrentOrganization();
        $userOrg = $context->getCurrentOrganizationUser();
        $orgRoles = [];

        if ($org) {
            $sids[] = self::fromAccount($org);
        }

        if (null !== $userOrg) {
            $sids = array_merge($sids, static::getOrganizationGroups($userOrg));
            $orgRoles = static::getOrganizationUserRoles($userOrg, $roleHierarchy);
        } elseif ($org && $org->isUserOrganization()) {
            $orgRoles = static::getOrganizationRoles($org, $roleHierarchy);
        }

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

        return $sids;
    }
protected static function getSecurityIdentityForCurrentOrganization ( OrganizationalContextInterface $ context , $ roleHierarchy = null ) { $ sids = [ ] ; $ org = $ context -> getCurrentOrganization ( ) ; $ userOrg = $ context -> getCurrentOrganizationUser ( ) ; $ orgRoles = [ ] ; if ( $ org ) { $ sids [ ] = self :: fromAccount ( $ org ) ; } if ( null !== $ userOrg ) { $ sids = array_merge ( $ sids , static :: getOrganizationGroups ( $ userOrg ) ) ; $ orgRoles = static :: getOrganizationUserRoles ( $ userOrg , $ roleHierarchy ) ; } elseif ( $ org && $ org -> isUserOrganization ( ) ) { $ orgRoles = static :: getOrganizationRoles ( $ org , $ roleHierarchy ) ; } foreach ( $ orgRoles as $ role ) { $ sids [ ] = RoleSecurityIdentity :: fromAccount ( $ role ) ; } return $ sids ; }
Get the security identities for the current organization of user.

@param OrganizationalContextInterface $context       The organizational context
@param null|RoleHierarchyInterface    $roleHierarchy The role hierarchy

@return SecurityIdentityInterface[]
Get the security identities for the current organization of user .