@weaviate
    Preparing search index...

    Interface Roles

    interface Roles {
        addPermissions: (
            roleName: string,
            permissions: PermissionsInput,
        ) => Promise<void>;
        assignedUserIds: (roleName: string) => Promise<string[]>;
        byName: (roleName: string) => Promise<Role | null>;
        create: (roleName: string, permissions?: PermissionsInput) => Promise<Role>;
        delete: (roleName: string) => Promise<void>;
        exists: (roleName: string) => Promise<boolean>;
        getGroupAssignments: (roleName: string) => Promise<GroupAssignment[]>;
        hasPermissions: (
            roleName: string,
            permission: Permission | Permission[],
        ) => Promise<boolean>;
        listAll: () => Promise<Record<string, Role>>;
        removePermissions: (
            roleName: string,
            permissions: PermissionsInput,
        ) => Promise<void>;
        userAssignments: (roleName: string) => Promise<UserAssignment[]>;
    }
    Index
    addPermissions: (
        roleName: string,
        permissions: PermissionsInput,
    ) => Promise<void>

    Add permissions to a role.

    Type Declaration

      • (roleName: string, permissions: PermissionsInput): Promise<void>
      • Parameters

        • roleName: string

          The name of the role to add permissions to.

        • permissions: PermissionsInput

          The permissions to add.

        Returns Promise<void>

        A promise that resolves when the permissions are added.

    assignedUserIds: (roleName: string) => Promise<string[]>

    Retrieve the user IDs assigned to a role.

    Type Declaration

      • (roleName: string): Promise<string[]>
      • Parameters

        • roleName: string

          The name of the role to retrieve the assigned user IDs for.

        Returns Promise<string[]>

        The user IDs assigned to the role.

        @deprecated: Use userAssignments instead.

    byName: (roleName: string) => Promise<Role | null>

    Retrieve a role by its name.

    Type Declaration

      • (roleName: string): Promise<Role | null>
      • Parameters

        • roleName: string

          The name of the role to retrieve.

        Returns Promise<Role | null>

        The role if it exists, or null if it does not.

    create: (roleName: string, permissions?: PermissionsInput) => Promise<Role>

    Create a new role.

    Type Declaration

      • (roleName: string, permissions?: PermissionsInput): Promise<Role>
      • Parameters

        • roleName: string

          The name of the new role.

        • Optionalpermissions: PermissionsInput

          The permissions to assign to the new role.

        Returns Promise<Role>

        The newly created role.

    delete: (roleName: string) => Promise<void>

    Delete a role by its name.

    Type Declaration

      • (roleName: string): Promise<void>
      • Parameters

        • roleName: string

          The name of the role to delete.

        Returns Promise<void>

        A promise that resolves when the role is deleted.

    exists: (roleName: string) => Promise<boolean>

    Check if a role exists.

    Type Declaration

      • (roleName: string): Promise<boolean>
      • Parameters

        • roleName: string

          The name of the role to check for.

        Returns Promise<boolean>

        A promise that resolves to true if the role exists, or false if it does not.

    getGroupAssignments: (roleName: string) => Promise<GroupAssignment[]>

    Get the IDs and group type of groups that assigned this role.

    Type Declaration

      • (roleName: string): Promise<GroupAssignment[]>
      • Parameters

        • roleName: string

          The name of the role to check.

        Returns Promise<GroupAssignment[]>

        A promise that resolves to an array of group names assigned to this role.

    hasPermissions: (
        roleName: string,
        permission: Permission | Permission[],
    ) => Promise<boolean>

    Check if a role has the specified permissions.

    Type Declaration

      • (roleName: string, permission: Permission | Permission[]): Promise<boolean>
      • Parameters

        • roleName: string

          The name of the role to check.

        • permission: Permission | Permission[]

          The permission or permissions to check for.

        Returns Promise<boolean>

        A promise that resolves to true if the role has the permissions, or false if it does not.

    listAll: () => Promise<Record<string, Role>>

    Retrieve all the roles in the system.

    Type Declaration

      • (): Promise<Record<string, Role>>
      • Returns Promise<Record<string, Role>>

        A map of role names to their respective roles.

    removePermissions: (
        roleName: string,
        permissions: PermissionsInput,
    ) => Promise<void>

    Remove permissions from a role.

    Type Declaration

      • (roleName: string, permissions: PermissionsInput): Promise<void>
      • Parameters

        • roleName: string

          The name of the role to remove permissions from.

        • permissions: PermissionsInput

          The permissions to remove.

        Returns Promise<void>

        A promise that resolves when the permissions are removed.

    userAssignments: (roleName: string) => Promise<UserAssignment[]>

    Retrieve the user IDs assigned to a role. Each user has a qualifying user type, e.g. 'db_user' | 'db_env_user' | 'oidc'.

    Note, unlike assignedUserIds, this method may return multiple entries for the same username, if OIDC authentication is enabled: once with 'db_*' and once with 'oidc' user type.

    Type Declaration

      • (roleName: string): Promise<UserAssignment[]>
      • Parameters

        • roleName: string

          The name of the role to retrieve the assigned user IDs for.

        Returns Promise<UserAssignment[]>

        User IDs and user types assigned to the role.