This interface is used to work with an external portal in a workspace.

Hierarchy

  • Portal

Properties

Readonly namespace

namespace: string

Code of the workspace that the portal is created in.

Readonly profiles

Manage user profiles.

Readonly published

published: boolean

If the portal is published. After being published, the portal becomes available to the external users.

Methods

addProfile Deprecated

  • Deprecated

    Deprecated. Provide the specified profile access to the portal.

    Example:

    const user = await System.users.search().first();
    if (user) { 
        const profile = await Namespace.portal.profiles. getByUser(user); 
        if (profile) { 
            await Namespace.portal. addProfile(profile); 
        } 
    } 
    

    Use the grantAccess() method.

    Parameters

    Returns Promise<void>

addUser

  • Create a portal user.

    This method creates a portal user from an existing profile with the Invited status. At the moment, a profile can only be stored in the ** External users** system collection (_user_profiles). The method returns errors with the following codes: — 400: the profile is not an item of the ** External users** collection. — 409: a user with the specified email or OAuth2 authorization settings already exists. — 412: there are no available portal licenses. — 500 in all other cases.

    Parameters

    Returns Promise<UserItem>

addUserWithoutConfirmation

  • Add a portal user using an existing profile with OAuth2 authorization.

    Important: Once a user has been created, the OAuth2 authorization credentials cannot be changed. The method creates a new portal user using their profile and adds the credentials for OAuth2 authorization. Currently, the profile can only be located in the system collection External users (_user_profiles). The method returns errors with the following codes: — 400: no OAuth2 authorization parameters are passed or the profile is not an item of the “External Users” collection. — 409: a user with the specified email or OAuth2 authorization settings already exists. — 412: there are no available portal licenses. — 500 in all other cases.

    Parameters

    Returns Promise<void>

denyAccess

  • Deny the specified profile access to the portal.

    Example:

    const user = await System.users.search().first();
    if (user) { 
        const profile = await Namespace.portal.profiles. getByUser(user); 
        if (profile) { 
            await Namespace.portal. denyAccess(profile); 
        } 
    } 
    

    Parameters

    Returns Promise<void>

generateELMAAppUrl

  • generateELMAAppUrl(withAuthToken?: undefined | false | true): Promise<string>
  • Generate a link to the portal for the mobile app or desktop app.

    If the withAuthToken parameter is set to true, the generated link will include a short-lived authentication token for the current user, allowing automatic access to the target portal (without an additional authentication procedure). The method is available only in client-side scripts. Example:

    const ELMAAppUrl = await Namespace.portal. generateELMAAppUrl();
    

    Parameters

    • Optional withAuthToken: undefined | false | true

    Returns Promise<string>

getPages

  • Get a list of portal pages in the current workspace.

    Example:

    const pages = await Namespace.portal.getPages();
    

    Returns Promise<PortalPageInfo[]>

getSettings

  • Get portal settings.

    Example:

    const settings = await Namespace.portal. getSettings();
    

    Returns Promise<PortalSettings>

grantAccess

  • Grant the specified profile access to the portal.

    Example:

    const user = await System.users.search().first();
    if (user) { 
        const profile = await Namespace.portal.profiles. getByUser(user); 
        if (profile) { 
            await Namespace.portal. grantAccess(profile); 
        } 
    } 
    

    Parameters

    Returns Promise<void>

removeProfile Deprecated

  • Deprecated

    Deprecated. Deny a profile access to the portal.

    Example:

    const user = await System.users.search().first();
    if (user) { 
        const profile = await Namespace.portal.profiles. getByUser(user); 
        if (profile) { 
            await Namespace.portal. removeProfile(profile); 
        } 
    } 
    

    Use the denyAccess() method.

    Parameters

    Returns Promise<void>

setPortalUserAsInternal

  • setPortalUserAsInternal(portalUser: UserItemRef, _unsafe_ignore_oauth?: undefined | false | true): Promise<void>
  • Make a portal user an internal user of the system.

    Example:

    const portalUser = await Namespace.portal.profiles. getUser(profile);
    await Namespace.portal. setPortalUserAsInternal(portalUser); 
    

    Parameters

    • portalUser: UserItemRef
    • Optional _unsafe_ignore_oauth: undefined | false | true

    Returns Promise<void>

signupUrl

  • Get a link for the registration of an external user.

    You can create a URL for registration with contact details confirmation:

    if (Context.data.user_profile) {
        const inviteUrl = await  Namespace.portal.signupUrl(Context.data.user_profile); 
    } 
    

    To create a URL without contact details confirmation and send the URL to a designated person, you need to pass the withSign parameter:

    if  (Context.data.user_profile) {
        const inviteUrl = await Namespace.portal. signupUrl(Context.data.user_profile, { 
            withSign: true 
        }); 
    }  
    

    To refresh a URL created earlier, pass the refresh parameter:

    if (Context.data.user_profile) {
        const inviteUrl = await  Namespace.portal.signupUrl(Context.data.user_profile, { 
            refresh:  true, 
        }); 
    } 
    

    Type parameters

    Parameters

    Returns Promise<string>