LogoLogo
Studio
4.3
4.3
  • HarperDB Docs
  • Getting Started
  • Developers
    • Applications
      • Caching
      • Defining Schemas
      • Debugging Applications
      • Define Fastify Routes
      • Example Projects
    • Components
      • Installing
      • Writing Extensions
      • Operations
      • Google Data Studio
      • SDKs
      • Drivers
    • REST
    • Operations API
      • Quick Start Examples
      • Databases and Tables
      • NoSQL Operations
      • Bulk Operations
      • Users and Roles
      • Clustering
      • Custom Functions
      • Components
      • Registration
      • Jobs
      • Logs
      • Utilities
      • Token Authentication
      • SQL Operations
      • Advanced JSON SQL Examples
    • Real-Time
    • Clustering
      • Requirements and Definitions
      • Creating A Cluster User
      • Naming A Node
      • Enabling Clustering
      • Establishing Routes
      • Subscription Overview
      • Managing Subscriptions
      • Things Worth Knowing
      • Certificate Management
    • Security
      • JWT Authentication
      • Basic Authentication
      • mTLS Authentication
      • Configuration
      • Users & Roles
      • Certificate Management
    • SQL Guide
      • SQL Features Matrix
      • SQL Date Functions
      • SQL Reserved Word
      • SQL Functions
      • SQL JSON Search
      • SQL Geospatial Functions
  • Administration
    • Best Practices and Recommendations
    • Logging
      • Standard Logging
      • Audit Logging
      • Transaction Logging
    • Clone Node
    • Compact
    • Jobs
    • HarperDB Studio
      • Create an Account
      • Log In & Password Reset
      • Organizations
      • Instances
      • Query Instance Data
      • Manage Databases / Browse Data
      • Manage Charts
      • Manage Clustering
      • Manage Instance Users
      • Manage Instance Roles
      • Manage Applications
      • Instance Metrics
      • Instance Configuration
      • Enable Mixed Content
  • Deployments
    • Configuration File
    • HarperDB CLI
    • Install HarperDB
      • On Linux
    • Upgrade a HarperDB Instance
    • HarperDB Cloud
      • IOPS Impact on Performance
      • Instance Size Hardware Specs
      • Alarms
      • Verizon 5G Wavelength
  • Technical Details
    • Reference
      • Analytics
      • Architecture
      • Content Types
      • Data Types
      • Dynamic Schema
      • HarperDB Headers
      • HarperDB Limits
      • Globals
      • Resource Class
      • Transactions
      • Storage Algorithm
    • Release Notes
      • HarperDB Tucker (Version 4)
        • 4.3.36
        • 4.3.35
        • 4.3.34
        • 4.3.33
        • 4.3.32
        • 4.3.31
        • 4.3.30
        • 4.3.29
        • 4.3.28
        • 4.3.27
        • 4.3.26
        • 4.3.25
        • 4.3.24
        • 4.3.23
        • 4.3.22
        • 4.3.21
        • 4.3.20
        • 4.3.19
        • 4.3.18
        • 4.3.17
        • 4.3.16
        • 4.3.15
        • 4.3.14
        • 4.3.13
        • 4.3.12
        • 4.3.11
        • 4.3.10
        • 4.3.9
        • 4.3.8
        • 4.3.7
        • 4.3.6
        • 4.3.5
        • 4.3.4
        • 4.3.3
        • 4.3.2
        • 4.3.1
        • 4.3.0
        • 4.2.8
        • 4.2.7
        • 4.2.6
        • 4.2.5
        • 4.2.4
        • 4.2.3
        • 4.2.2
        • 4.2.1
        • 4.2.0
        • 4.1.2
        • 4.1.1
        • 4.1.0
        • 4.0.7
        • 4.0.6
        • 4.0.5
        • 4.0.4
        • 4.0.3
        • 4.0.2
        • 4.0.1
        • 4.0.0
        • HarperDB Monkey (Version 3)
        • 3.3.0
        • 3.2.1
        • 3.2.0
        • 3.1.5
        • 3.1.4
        • 3.1.3
        • 3.1.2
        • 3.1.1
        • 3.1.0
        • 3.0.0
        • HarperDB Penny (Version 2)
        • 2.3.1
        • 2.3.0
        • 2.2.3
        • 2.2.2
        • 2.2.0
        • 2.1.1
        • HarperDB Alby (Version 1)
        • 1.3.1
        • 1.3.0
        • 1.2.0
        • 1.1.0
  • More Help
    • Support
    • Slack
    • Contact Us
Powered by GitBook
On this page
  • List Roles
  • Body
  • Response: 200
  • Add Role
  • Body
  • Response: 200
  • Alter Role
  • Body
  • Response: 200
  • Drop Role
  • Body
  • Response: 200
  • List Users
  • Body
  • Response: 200
  • User Info
  • Body
  • Response: 200
  • Add User
  • Body
  • Response: 200
  • Alter User
  • Body
  • Response: 200
  • Drop User
  • Body
  • Response: 200
  1. Developers
  2. Operations API

Users and Roles

PreviousBulk OperationsNextClustering

Last updated 7 months ago

List Roles

Returns a list of all roles.

Operation is restricted to super_user roles only

  • operation (required) - must always be list_roles

Body

{
  "operation": "list_roles"
}

Response: 200

[
    {
        "__createdtime__": 1611615061106,
        "__updatedtime__": 1611615061106,
        "id": "05c2ffcd-f780-40b1-9432-cfe8ba5ad890",
        "permission": {
            "super_user": false,
            "dev": {
                "tables": {
                    "dog": {
                        "read": true,
                        "insert": true,
                        "update": true,
                        "delete": false,
                        "attribute_permissions": [
                            {
                                "attribute_name": "name",
                                "read": true,
                                "insert": true,
                                "update": true
                            }
                        ]
                    }
                }
            }
        },
        "role": "developer"
    },
    {
        "__createdtime__": 1610749235614,
        "__updatedtime__": 1610749235614,
        "id": "136f03fa-a0e9-46c3-bd5d-7f3e7dd5b564",
        "permission": {
            "cluster_user": true
        },
        "role": "cluster_user"
    },
    {
        "__createdtime__": 1610749235609,
        "__updatedtime__": 1610749235609,
        "id": "745b3138-a7cf-455a-8256-ac03722eef12",
        "permission": {
            "super_user": true
        },
        "role": "super_user"
    }
]

Add Role

Operation is restricted to super_user roles only

  • operation (required) - must always be add_role

  • role (required) - name of role you are defining

  • permission (required) - object defining permissions for users associated with this role:

    • super_user (optional) - boolean which, if set to true, gives users associated with this role full access to all operations and methods. If not included, value will be assumed to be false.

    • structure_user (optional) - boolean OR array of database names (as strings). If boolean, user can create new databases and tables. If array of strings, users can only manage tables within the specified databases. This overrides any individual table permissions for specified databases, or for all databases if the value is true.

Body

{
    "operation": "add_role",
    "role": "developer",
    "permission": {
        "super_user": false,
        "structure_user": false,
        "dev": {
            "tables": {
                "dog": {
                    "read": true,
                    "insert": true,
                    "update": true,
                    "delete": false,
                    "attribute_permissions": [
                        {
                            "attribute_name": "name",
                            "read": true,
                            "insert": true,
                            "update": true
                        }
                    ]
                }
            }
        }
    }
}

Response: 200

{
    "role": "developer",
    "permission": {
        "super_user": false,
        "structure_user": false,
        "dev": {
            "tables": {
                "dog": {
                    "read": true,
                    "insert": true,
                    "update": true,
                    "delete": false,
                    "attribute_permissions": [
                        {
                            "attribute_name": "name",
                            "read": true,
                            "insert": true,
                            "update": true
                        }
                    ]
                }
            }
        }
    },
    "id": "0a9368b0-bd81-482f-9f5a-8722e3582f96",
    "__updatedtime__": 1598549532897,
    "__createdtime__": 1598549532897
}

Alter Role

Operation is restricted to super_user roles only

  • operation (required) - must always be alter_role

  • id (required) - the id value for the role you are altering

  • role (optional) - name value to update on the role you are altering

  • permission (required) - object defining permissions for users associated with this role:

    • super_user (optional) - boolean which, if set to true, gives users associated with this role full access to all operations and methods. If not included, value will be assumed to be false.

    • structure_user (optional) - boolean OR array of database names (as strings). If boolean, user can create new databases and tables. If array of strings, users can only manage tables within the specified databases. This overrides any individual table permissions for specified databases, or for all databases if the value is true.

Body

{
    "operation": "alter_role",
    "id": "f92162e2-cd17-450c-aae0-372a76859038",
    "role": "another_developer",
    "permission": {
        "super_user": false,
        "structure_user": false,
        "dev": {
            "tables": {
                "dog": {
                    "read": true,
                    "insert": true,
                    "update": true,
                    "delete": false,
                    "attribute_permissions": [
                        {
                            "attribute_name": "name",
                            "read": false,
                            "insert": true,
                            "update": true
                        }
                    ]
                }
            }
        }
    }
}

Response: 200

{
    "id": "a7cb91e9-32e4-4dbf-a327-fab4fa9191ea",
    "role": "developer",
    "permission": {
        "super_user": false,
        "structure_user": false,
        "dev": {
            "tables": {
                "dog": {
                    "read": true,
                    "insert": true,
                    "update": true,
                    "delete": false,
                    "attribute_permissions": [
                        {
                            "attribute_name": "name",
                            "read": false,
                            "insert": true,
                            "update": true
                        }
                    ]
                }
            }
        }
    },
    "__updatedtime__": 1598549996106
}

Drop Role

Operation is restricted to super_user roles only

  • operation (required) - this must always be drop_role

  • id (required) - this is the id of the role you are dropping

Body

{
    "operation": "drop_role",
    "id": "developer"
}

Response: 200

{
    "message": "developer successfully deleted"
}

List Users

Operation is restricted to super_user roles only

  • operation (required) - must always be list_users

Body

{
    "operation": "list_users"
}

Response: 200

[
    {
        "__createdtime__": 1635520961165,
        "__updatedtime__": 1635520961165,
        "active": true,
        "role": {
            "__createdtime__": 1635520961161,
            "__updatedtime__": 1635520961161,
            "id": "7c78ef13-c1f3-4063-8ea3-725127a78279",
            "permission": {
                "super_user": true,
                "system": {
                    "tables": {
                        "hdb_table": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_attribute": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_schema": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_user": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_role": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_job": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_license": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_info": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_nodes": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        },
                        "hdb_temp": {
                            "read": true,
                            "insert": false,
                            "update": false,
                            "delete": false,
                            "attribute_permissions": []
                        }
                    }
                }
            },
            "role": "super_user"
        },
        "username": "HDB_ADMIN"
    }
]

User Info

Returns user data for the associated user credentials.

  • operation (required) - must always be user_info

Body

{
    "operation": "user_info"
}

Response: 200

{
    "__createdtime__": 1610749235611,
    "__updatedtime__": 1610749235611,
    "active": true,
    "role": {
        "__createdtime__": 1610749235609,
        "__updatedtime__": 1610749235609,
        "id": "745b3138-a7cf-455a-8256-ac03722eef12",
        "permission": {
            "super_user": true
        },
        "role": "super_user"
    },
    "username": "HDB_ADMIN"
}

Add User

Operation is restricted to super_user roles only

  • operation (required) - must always be add_user

  • role (required) - 'role' name value of the role you wish to assign to the user. See add_role for more detail

  • username (required) - username assigned to the user. It can not be altered after adding the user. It serves as the hash

  • password (required) - clear text for password. HarperDB will encrypt the password upon receipt

  • active (required) - boolean value for status of user's access to your HarperDB instance. If set to false, user will not be able to access your instance of HarperDB.

Body

{
  "operation": "add_user",
  "role": "role_name",
  "username": "hdb_user",
  "password": "password",
  "active": true
}

Response: 200

{
  "message": "hdb_user successfully added"
}

Alter User

Operation is restricted to super_user roles only

  • operation (required) - must always be alter_user

  • username (required) - username assigned to the user. It can not be altered after adding the user. It serves as the hash.

  • password (optional) - clear text for password. HarperDB will encrypt the password upon receipt

  • role (optional) - role name value of the role you wish to assign to the user. See add_role for more detail

  • active (optional) - status of user's access to your HarperDB instance. See add_role for more detail

Body

{
  "operation": "alter_user",
  "role": "role_name",
  "username": "hdb_user",
  "password": "password",
  "active": true
}

Response: 200

{
  "message": "updated 1 of 1 records",
  "new_attributes": [],
  "txn_time": 1611615114397.988,
  "update_hashes": [
      "hdb_user"
  ],
  "skipped_hashes": []
}

Drop User

Operation is restricted to super_user roles only

  • operation (required) - must always be drop_user

  • username (required) - username assigned to the user

Body

{
  "operation": "drop_user",
  "username": "sgoldberg"
}

Response: 200

{
  "message": "sgoldberg successfully deleted"
}

Creates a new role with the specified permissions.

Modifies an existing role with the specified permissions. updates permissions from an existing role.

Deletes an existing role from the database. NOTE: Role with associated users cannot be dropped.

Returns a list of all users.

Creates a new user with the specified role and credentials.

Modifies an existing user's role and/or credentials.

Deletes an existing user by username.

Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.
Learn more about HarperDB roles here.