@inweb/client
    Preparing search index...

    Class Permission

    Provides properties and methods for obtaining information about file actions granted to a specific user, project, or group.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Parameters

      • data: any

        Raw permission data received from the server. For more information, see Open Cloud Permissions API.

      • fileId: string

        Owner file ID.

      • httpClient: IHttpClient

        HTTP client instance used to send requests to the REST API server.

      Returns Permission

    Properties

    headers: HeadersInit

    Endpoint-specific HTTP headers for the GET, POST, PUT and DELETE requests. You can add custom headers at any time.

    path: string

    Endpoint API path relative to the REST API server URL.

    Accessors

    • get actions(): string[]

      Defines what actions are allowed to be performed on a file with this permission:

      • read - The ability to read file description, geometry data and properties.
      • readSourceFile - The ability to download source file.
      • write - The ability to modify file name, description and references.
      • readViewpoint - The ability to read file viewpoints.
      • createViewpoint - The ability to create file viewpoints.

      Returns string[]

      const myFile = client.getFile(myFileId);
      const permissions = await myFile.getPermissions();
      const projectPermissions = permissions.filter((permission) =>
      permission.grantedTo.some((x) => x.project?.id === myProjectId)
      );
      const newActions = ["read", "readSourceFile", "update"];
      await Promise.all(
      projectPermissions.map((permission) => {
      permission.actions = newActions;
      return permission.save();
      })
      );
    • get grantedTo(): IGrantedTo[]

      A list of users, projects, or groups that will get access to the file.

      Returns IGrantedTo[]

    • get id(): string

      Unique permission ID.

      Returns string

    • get public(): boolean

      Specifies whether all users have access to the file or not.

      Returns boolean

    Methods

    • Removes a permission from the file.

      Returns Promise<any>

      Returns the raw data of a deleted permission. For more information, see Open Cloud Permissions API.

    • Saves permission properties changes to the server. Call this method to update permission data on the server after any property changes.

      Returns Promise<Permission>