Identity/OrganizationSecurityIdentity.php
protected static function getOrganizationUserRoles(OrganizationUserInterface $user, $roleHierarchy = null)
    {
        $roles = [];

        if ($user instanceof RoleableInterface && $user instanceof OrganizationUserInterface) {
            $org = $user->getOrganization();
            $roles = self::buildOrganizationUserRoles($roles, $user, $org->getName());
            $roles = self::buildOrganizationRoles($roles, $org);

            if ($roleHierarchy instanceof RoleHierarchyInterface) {
                $roles = RoleUtil::formatNames($roleHierarchy->getReachableRoles($roles));
            }
        }

        return $roles;
    }
protected static function getOrganizationUserRoles(OrganizationUserInterface $user, $roleHierarchy = null)
    {
        $roles = [];

        if ($user instanceof RoleableInterface && $user instanceof OrganizationUserInterface) {
            $org = $user->getOrganization();
            $roles = self::buildOrganizationUserRoles($roles, $user, $org->getName());
            $roles = self::buildOrganizationRoles($roles, $org);

            if ($roleHierarchy instanceof RoleHierarchyInterface) {
                $roles = RoleUtil::formatNames($roleHierarchy->getReachableRoles($roles));
            }
        }

        return $roles;
    }
protected static function getOrganizationUserRoles ( OrganizationUserInterface $ user , $ roleHierarchy = null ) { $ roles = [ ] ; if ( $ user instanceof RoleableInterface && $ user instanceof OrganizationUserInterface ) { $ org = $ user -> getOrganization ( ) ; $ roles = self :: buildOrganizationUserRoles ( $ roles , $ user , $ org -> getName ( ) ) ; $ roles = self :: buildOrganizationRoles ( $ roles , $ org ) ; if ( $ roleHierarchy instanceof RoleHierarchyInterface ) { $ roles = RoleUtil :: formatNames ( $ roleHierarchy -> getReachableRoles ( $ roles ) ) ; } } return $ roles ; }
Get the organization roles of user.

@param OrganizationUserInterface   $user          The organization user
@param null|RoleHierarchyInterface $roleHierarchy The role hierarchy

@return string[]
Get the organization roles of user .