Provides properties and methods for obtaining information about a Open Cloud Server user and manage its data.

Hierarchy (View Summary)

Constructors

  • Parameters

    • data: any

      Raw user data received from the server. For more information, see Open Cloud Users API.

    • httpClient: IHttpClient

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

    Returns User

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 avatarUrl(): string
  • User avatar image URL or empty string if the user does not have an avatar. Use setAvatar() to change avatar image.

    Returns string

  • get canCreateProject(): boolean
  • true if user is allowed to create a projects.

    Only administrators can change create project permission.

    Returns boolean

  • get createAt(): string
  • Account registration time (UTC) in the format specified in ISO 8601.

    Returns string

  • get customFields(): any
  • User custom fields object, to store custom data.

    Returns any

  • get data(): any
  • Raw user data received from the server. For more information, see Open Cloud Users API.

    Returns any

  • get email(): string
  • User email.

    Returns string

  • get emailConfirmationId(): string
  • The user's email confirmation code, or an empty string if the email has already been confirmed.

    To send the confirmation code to the server, use Client.confirmUserEmail().

    Returns string

  • get firstName(): string
  • First name.

    Returns string

  • get fullName(): string
  • Full name. Returns the user's first and last name. If first name and last names are empty, returns the user name.

    Returns string

  • get id(): string
  • Unique user ID.

    Returns string

  • get initials(): string
  • User initials. Returns a first letters of the user's first and last names. If first name and last names are empty, returns the first letter of the user name.

    Returns string

  • get isAdmin(): boolean
  • true if user is an administrator.

    Only administrators can change user type.

    Returns boolean

  • get isEmailConfirmed(): boolean
  • false if the user has not yet confirmed his email address.

    Returns boolean

  • get lastModified(): string
  • User last update time (UTC) in the format specified in ISO 8601.

    Returns string

  • get lastName(): string
  • Last name.

    Returns string

  • get lastSignIn(): string
  • User last sign in time (UTC) in the format specified in ISO 8601.

    Returns string

  • get projectsLimit(): number
  • The maximum number of projects that a user can create.

    Only administrators can change projects limit.

    Returns number

  • get providerType(): string
  • The identity provider used to create the account. Can be ldap, oauth, saml or empty for local accounts.

    Returns string

  • get storageLimit(): number
  • User storage size on the server for uploading files.

    Only administrators can change storage size.

    Returns number

  • get storageUsed(): number
  • The total size of the user's files in the storage.

    Returns number

  • get token(): string
  • The user's access token (API key). Use Client.signInWithToken() to sign in to the server using this token.

    Returns string

  • get userName(): string
  • User name.

    Returns string

Methods

  • Changes the user password.

    Only administrators can change the passwords of other users. If the current logged in user is not an administrator, they can only change their password, otherwise an exception will be thrown.

    To change their password, non-administrator users must specify their old password.

    Parameters

    • newPassword: string

      New user password.

    • OptionaloldPassword: string

      Old user password. Only required for non-administrator users to change their password.

    Returns Promise<User>

  • Reloads user data from the server.

    Only administrators can checkout other users. If the current logged in user is not an administrator, they can only checkout themselves, otherwise an exception will be thrown.

    Returns Promise<User>

  • Deletes a user from the server.

    Only administrators can delete users. If the current logged in user is not an administrator, an exception will be thrown.

    Administrators can delete themselves or other administrators. An administrator can only delete themself if they is not the last administrator.

    You need to re-login after deleting the current logged in user.

    Returns Promise<any>

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

  • Removes the user avatar.

    Only administrators can remove the avatar of other users. If the current logged in user is not an administrator, they can only remove their avatar, otherwise an exception will be thrown.

    Returns Promise<User>

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

    Returns Promise<User>

  • Sets or removes the user avatar.

    Only administrators can set the avatar of other users. If the current logged in user is not an administrator, they can only set their avatar, otherwise an exception will be thrown.

    Parameters

    Returns Promise<User>

  • Updates user data on the server.

    Only administrators can update other users. If the current logged in user is not an administrator, they can only update themself, otherwise an exception will be thrown.

    Parameters

    Returns Promise<User>