LogoLogo
Studio
4.4
4.4
  • Harper Docs
  • Getting Started
  • Developers
    • Applications
      • Caching
      • Defining Schemas
      • Defining Roles
      • Debugging Applications
      • Define Fastify Routes
      • Web Applications
      • Example Projects
    • Components
      • Managing
      • Reference
      • Built-In Components
    • REST
    • Operations API
      • Quick Start Examples
      • Databases and Tables
      • NoSQL Operations
      • Bulk Operations
      • Users and Roles
      • Clustering
        • Clustering with NATS
      • Custom Functions
      • Components
      • Registration
      • Jobs
      • Logs
      • Utilities
      • Token Authentication
      • SQL Operations
      • Advanced JSON SQL Examples
    • Real-Time
    • Replication/Clustering
      • Sharding
      • Legacy NATS 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
    • Miscellaneous
      • Google Data Studio
      • SDKs
      • Query Optimization
  • Administration
    • Best Practices and Recommendations
    • Logging
      • Standard Logging
      • Audit Logging
      • Transaction Logging
    • Clone Node
    • Compact
    • Jobs
    • Harper Studio
      • Create an Account
      • Log In & Password Reset
      • Organizations
      • Instances
      • Manage Databases / Browse Data
      • Manage Clustering
      • Manage Instance Users
      • Manage Instance Roles
      • Manage Applications
      • Instance Metrics
      • Instance Configuration
      • Enable Mixed Content
  • Deployments
    • Configuration File
    • Harper CLI
    • Install Harper
      • On Linux
    • Upgrade a Harper Instance
    • Harper Cloud
      • IOPS Impact on Performance
      • Instance Size Hardware Specs
      • Alarms
      • Verizon 5G Wavelength
  • Technical Details
    • Reference
      • Analytics
      • Architecture
      • Content Types
      • Data Types
      • Dynamic Schema
      • GraphQL
      • Harper Headers
      • Harper Limits
      • Globals
      • Resource Class
      • Transactions
      • Storage Algorithm
    • Release Notes
      • Harper Tucker (Version 4)
        • 4.4.24
        • 4.4.23
        • 4.4.22
        • 4.4.21
        • 4.4.20
        • 4.4.19
        • 4.4.18
        • 4.4.17
        • 4.4.16
        • 4.4.15
        • 4.4.14
        • 4.4.13
        • 4.4.12
        • 4.4.11
        • 4.4.10
        • 4.4.9
        • 4.4.8
        • 4.4.7
        • 4.4.6
        • 4.4.5
        • 4.4.4
        • 4.4.3
        • 4.4.2
        • 4.4.1
        • 4.4.0
        • 4.3.38
        • 4.3.37
        • 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
        • Tucker
      • 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 2 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. Harper will encrypt the password upon receipt

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

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. Harper 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 Harper 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 Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.
Learn more about Harper roles here.