Class PermissionsAPIInternal

The class that encapsulates the permissions API

Constructors

Properties

api: API
contextOptions: ContextOptions
granted: {
    delete: ((grantedPermissionId) => Promise<BazaarMessage>);
    list: ((query?) => Promise<GrantedPermission[]>);
    subscribe: ((query?, listener) => Promise<(() => Promise<BazaarMessage>)>);
} = ...

Granted Permissions

Type declaration

groups: {
    addMember: ((groupId, userId) => Promise<BazaarMessage>);
    create: ((group) => Promise<{
        id: string;
    }>);
    delete: ((groupId) => Promise<BazaarMessage>);
    get: ((groupId) => Promise<PermissionGroup>);
    list: (() => Promise<PermissionGroup[]>);
    removeMember: ((groupId, userId) => Promise<BazaarMessage>);
} = ...

Groups

Type declaration

  • addMember: ((groupId, userId) => Promise<BazaarMessage>)
  • create: ((group) => Promise<{
        id: string;
    }>)

    Creates a new group Groups require at least one member.

      • (group): Promise<{
            id: string;
        }>
      • Parameters

        • group: NewPermissionGroup

        Returns Promise<{
            id: string;
        }>

  • delete: ((groupId) => Promise<BazaarMessage>)
  • get: ((groupId) => Promise<PermissionGroup>)

    Get group by Id

    Returns

    group for a given ID

  • list: (() => Promise<PermissionGroup[]>)

    Lists groups

    Returns

    a list of groups user is part of (in current app)

  • removeMember: ((groupId, userId) => Promise<BazaarMessage>)
linkUri: string
links: {
    create: ((permission, description?, limit?) => Promise<{
        description: string;
        id: string;
        limit: number;
        permission: PermissionTemplate;
        url: string;
        users: string[];
    }>);
    delete: ((linkId) => Promise<BazaarMessage>);
    list: ((query?) => Promise<Link[]>);
    subscribe: ((query?, listener) => Promise<(() => Promise<BazaarMessage>)>);
} = ...

Links

Type declaration

  • create: ((permission, description?, limit?) => Promise<{
        description: string;
        id: string;
        limit: number;
        permission: PermissionTemplate;
        url: string;
        users: string[];
    }>)

    Creates a link

      • (permission, description?, limit?): Promise<{
            description: string;
            id: string;
            limit: number;
            permission: PermissionTemplate;
            url: string;
            users: string[];
        }>
      • Parameters

        Returns Promise<{
            description: string;
            id: string;
            limit: number;
            permission: PermissionTemplate;
            url: string;
            users: string[];
        }>

  • delete: ((linkId) => Promise<BazaarMessage>)

    Deletes a link

  • list: ((query?) => Promise<Link[]>)

    Lists links

  • subscribe: ((query?, listener) => Promise<(() => Promise<BazaarMessage>)>)

    Subscribes to links changes

    Returns

    an unsubscribe function

Methods

  • Creates permission for a collection query and a user.

    Parameters

    • permission: NewPermission

      "Specifies the permission to be created"

    • notification: SharingNotification = noSharingNotification

      "Specifies if/how the user is notified. Defaults to {createNotification: false, sendMessage: SendNotification.Never}"

    Returns Promise<{
        id: string;
    }>