Identity/OrganizationSecurityIdentity.php
private static function buildOrganizationRoles(array $roles, OrganizationInterface $org)
    {
        $orgName = $org->getName();

        if ($org instanceof RoleableInterface) {
            $existingRoles = [];

            foreach ($roles as $role) {
                $existingRoles[] = $role;
            }

            foreach ($org->getRoles() as $orgRole) {
                $roleName = RoleUtil::formatName($orgRole);

                if (!\in_array($roleName, $existingRoles, true)) {
                    $roles[] = $roleName.'__'.$orgName;
                    $existingRoles[] = $roleName;
                }
            }
        }

        return $roles;
    }
private static function buildOrganizationRoles(array $roles, OrganizationInterface $org)
    {
        $orgName = $org->getName();

        if ($org instanceof RoleableInterface) {
            $existingRoles = [];

            foreach ($roles as $role) {
                $existingRoles[] = $role;
            }

            foreach ($org->getRoles() as $orgRole) {
                $roleName = RoleUtil::formatName($orgRole);

                if (!\in_array($roleName, $existingRoles, true)) {
                    $roles[] = $roleName.'__'.$orgName;
                    $existingRoles[] = $roleName;
                }
            }
        }

        return $roles;
    }
private static function buildOrganizationRoles ( array $ roles , OrganizationInterface $ org ) { $ orgName = $ org -> getName ( ) ; if ( $ org instanceof RoleableInterface ) { $ existingRoles = [ ] ; foreach ( $ roles as $ role ) { $ existingRoles [ ] = $ role ; } foreach ( $ org -> getRoles ( ) as $ orgRole ) { $ roleName = RoleUtil :: formatName ( $ orgRole ) ; if ( ! \ in_array ( $ roleName , $ existingRoles , true ) ) { $ roles [ ] = $ roleName . '__' . $ orgName ; $ existingRoles [ ] = $ roleName ; } } } return $ roles ; }
Build the user organization roles.

@param string[]              $roles The roles
@param OrganizationInterface $org   The organization of user

@return string[]
Build the user organization roles .