User Management Service

A user management service, with support for configuring roles and permission.

Operations

Roles

Socials

Users

Events

Operations

Roles


addRoleParam

Adds parameter definition to given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
body [ object ] List of role parameter definition
body[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Responses
A role definition - object
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["body"] = {
    {
      ["name"] = "sn"
    },
    {
      ["name"] = "rid"
    }
  }
}
response.message = User.addRoleParam(parameters)

addRolePerm

Adds permission to given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
body [ object ] List of Permissions
body[].method ^[A-Z]{1,10}$ Http method of the endpoint
body[].end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Responses
List of Permissions - [ object ]
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["body"] = {
    {
      ["method"] = "GET",
      ["end_point"] = "info/{sn}"
    },
    {
      ["method"] = "GET",
      ["end_point"] = "info/{rid}"
    }
  }
}
response.message = User.addRolePerm(parameters)

assignUser

Assigns given roles to given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
roles [ object ] List of user roles
roles[].role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
roles[].parameters [ object ] List role parameters
roles[][].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
roles[][].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["roles"] = {
    {
      ["role_id"] = "guest",
      ["parameters"] = {
        {
          ["name"] = "sn",
          ["value"] = "1"
        },
        {
          ["name"] = "sn",
          ["value"] = "2"
        },
        {
          ["name"] = "rid",
          ["value"] = "1"
        }
      }
    },
    {
      ["role_id"] = "admin",
      ["parameters"] = {
        {
          ["name"] = "sn",
          ["value"] = "999"
        }
      }
    }
  }
}
response.message = User.assignUser(parameters)

createRole

Creates role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Responses
A role definition - object
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local role = {
  ["role_id"] = "guest",
  ["parameter"] = {
    {
      ["name"] = "sn"
    },
    {
      ["name"] = "rid"
    }
  }
}
response.message = User.createRole(role)

deassignUser

Deassigns given role from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest"
}
response.message = User.deassignUser(parameters)

deassignUserParam

Deassigns given role with specific parameter value from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
parameter_value string Parameter value
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn",
  ["parameter_value"] = "1"
}
respons.message = User.deassignUserParam(parameters)

deassignUserParamName

Deassigns given role with specific parameter name from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn"
}
response.message = User.deassignUserParamName(parameters)

deleteRole

Delete given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
Responses
Deletion successful - nil

Deletion successful

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest"
}
response.message = User.deleteRole(parameters)

deleteRoleParam

Deletes given role parameter definition.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
parameter_name string Parameter name
Responses
A role definition - object
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["parameter_name"] = "sn"
}
response.message = User.deleteRoleParam(parameters)

deleteRoleParamValue

Deletes given role-parameter value.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
parameter_name string Parameter name
parameter_value string Parameter value
Responses
Deletion successful - nil

Deletion successful

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["parameter_name"] = "sn",
  ["parameter_value"] = 1
}
response.message = User.deleteRoleParamValue(parameters)

deleteRolePerm

Deletes permission from given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
perm_id string {method}/{end_point}
Responses
List of Permissions - [ object ]
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["perm_id"] = "GET/info/{sn}"
}
response.message = User.deleteRolePerm(parameters)

getRole

Gets role by Role ID.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
Responses
A role definition - object
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest"
}
response.message = User.getRole(parameters)

hasUserRoleParam

Checks if given user has given role with specific parameter.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
parameter_name string Parameter name
parameter_value string Parameter value
id integer User ID
Responses
"OK" if user has role - "OK"

"OK" if user has role

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["parameter_name"] = "sn",
  ["parameter_value"] = "1",
  ["id"] = 2
}
response.message = User.hasUserRoleParam(parameters)

listRoleParamUsers

Returns the list of user IDs in given role with specific parameter.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
parameter_name string Parameter name
parameter_value string Parameter value
Responses
List of user ID - [ integer ]

List of user ID

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest",
  ["parameter_name"] = "sn",
  ["parameter_value"] = "1"
}
response.message = User.listRoleParamUsers(parameters)

listRolePerms

Returns the list of permissions in given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
Responses
List of Permissions - [ object ]
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest"
}
response.message = User.listRolePerms(parameters)

listRoleUsers

Returns the list of user IDs in given role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
role_id string Role ID
Responses
List of user ID - [ integer ]

List of user ID

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["role_id"] = "guest"
}
response.message = User.listRoleUsers(parameters)

listRoles

Returns the list of roles.

Responses
List of roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameter [ object ] List of role parameter definition
parameter[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.listRoles()

listUserRoleParamValues

Returns the paginated list of values of given parameter name belong to given user role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
offset integer Pagination offset
limit integer {1..100} Pagination limit
Default: 100
Responses
Operation response object containing one page of user role parameters. - object
Name Type Description
items [ string ] One page list of parameters.
total integer Total number of keys.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn"
}
response.message = User.listUserRoleParamValues(parameters)

listUserRoles

Returns the list of assigned roles of given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.listUserRoles({["id"] = 2})

Socials


createSocial

Add a Social.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
scope [ string ] Specifies the level of access that the application is requesting
consumer string Consumer name
redirect string Redirect URI or Callback URL
client_id string Client Identifier
client_secret string Client Authentication
Responses
TODO - object
Name Type Description
scope [ string ] Specifies the level of access that the application is requesting
consumer string Consumer name
redirect string Redirect URI or Callback URL
client_id string Client Identifier
client_secret string Client Authentication
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local new_social = {
  ["consumer"] = "Google",
  ["client_id"] = "173032451965-6aritviopipcqec0j4cq5sxc1519m025.apps.googleusercontent.com",
  ["client_secret"] = "sNa2saB31xQnQ09sUc2OOywF",
  ["scope"] = {"profile","email"},
  ["redirect"] = "https://demo.apps.exosite-dev.io/social/handle/Google"
}
response.message = User.createSocial(new_social)

deleteSocial

Delete a social.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
Responses
Social deleted - nil

Social deleted

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google"
}
response.message = User.deleteSocial(parameters)

getSocial

Get social info.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
Responses
TODO - object
Name Type Description
scope [ string ] Specifies the level of access that the application is requesting
consumer string Consumer name
redirect string Redirect URI or Callback URL
client_id string Client Identifier
client_secret string Client Authentication
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google"
}
response.message = User.getSocial(parameters)

getSocialLoginUrl

Get social login URL.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
reqToken string The consumer request token
Responses
Consumer login url - string

Consumer login url

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google"
}
response.headers["location"] = User.getSocialLoginUrl(parameters) -- redierct to social login url response.code = 303

getSocialToken

Get social login Token

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
code string The consumer return code
state string The consumer return state
oauth_token string The consumer return oauth_token
oauth_verifier string The consumer return oauth_verifier
reqToken string The consumer return reqToken
Responses
Social token - string

Social token

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google",
  ["code"] = "7/Diur60jCjzCm14ukTdFgxow17OWxzDdj4rA6YQV1Sid",
  ["state"] = "56k120223c83a23b49a136725e63c717"
} -- info from Google servers for exchanging token
response.message = User.getSocialToken(parameters)

socialList

Listing socials.

Responses
List of socials - [ object ]
Name Type Description
scope [ string ] Specifies the level of access that the application is requesting
consumer string Consumer name
redirect string Redirect URI or Callback URL
client_id string Client Identifier
client_secret string Client Authentication
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.socialList()

socialRequest

Request social get information

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
token string The consumer return code
Responses
TODO - string

TODO

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google",
  ["token"] = "ZzozMzoiT0F1dGhcT0F1dGgyXFRva2VuXKN0ZE9BdXRoMlRva2VuIjo0OntzOjQ0OiIAKgBhY2Nlc3NUc2tlbiI7czo19ToieWEyOS5DaTlXQTZ1UUFCc3RYSnpmZGhDRjkyZnhaYXRvOURVMEdmTjgwTVRZSTJCbkI1MVptN1pZSjZVbm9vOXEtMktvZVEiO3M6MTU6IgCqAHJlZnJlc2hUb2tlbiI7TjtzOjEyOiIAKgBlbmRPZkxpZmUiO2k6MTQ3MzE1NDYyNztzOjE0OiIAKgBleHRyYVBhcmFtcyI7YToyOntzOjEwOiJ0b2tlbl90eXBlIjtzOjY6IkJTndILU03N2ZacVVVMTZxQlhjSGxILVI2NEVZOG9kVkNnYWM1UkdOVlI5eTA2LUNyeDdPcjlXcm10VmsyYVhMYXFkU3J5c0pqUFREWU5iX2NxM1RrTTFySThnQ1NJT3JhZmE5WHVhaXNtSHhTREtiQmN1bE41YXhCVnF0bFpKWUpUR3BLQmlaeGNGLVREQ1ZZQU5ZaVF4a0lzTjFoVHdlNF9ESzVGNWVaalozdFNzUHR6eGtvZkJBd3U0LWRLeGRWbkM3S25IdGhKLWI1ZVpMenU2aUFIdWRFdEFRckU0WGl6bTM4YkJaRkdRaGFDUVB5R3RXMlRHSTJ2UV9rZkZGbXBiMGFOUUJHTVhLdvkzcFZyR3BvYWpxZFlfZTRfdi13NUxiYXc1RVRuRWdkbmNqNUEi2391"
}
response.message = User.socialRequest(parameters)

updateSocial

Update a social definition.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
consumer string Consumer name
scope [ string ] Specifies the level of access that the application is requesting
redirect string Redirect URI or Callback URL
client_id string Client Identifier
client_secret string Client Authentication
Responses
Instance updated - nil

Instance updated

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["consumer"] = "Google",
  ["scope"] = {"email"}
}
response.message = User.updateSocial(parameters)

Users


activateUser

Activates user by given verification code.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
code string The verification code returned from registeration.
Responses
"OK" if activation successful - "OK"

"OK" if activation successful

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["code"] = "bb48f756e9bf9326d57f63bde70c68dbda90f286"
}
response.message = User.activateUser(parameters)

assignUser

Assigns given roles to given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
roles [ object ] List of user roles
roles[].role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
roles[].parameters [ object ] List role parameters
roles[][].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
roles[][].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["roles"] = {
    {
      ["role_id"] = "guest",
      ["parameters"] = {
        {
          ["name"] = "sn",
          ["value"] = "1"
        },
        {
          ["name"] = "sn",
          ["value"] = "2"
        },
        {
          ["name"] = "rid",
          ["value"] = "1"
        }
      }
    },
    {
      ["role_id"] = "admin",
      ["parameters"] = {
        {
          ["name"] = "sn",
          ["value"] = "999"
        }
      }
    }
  }
}
response.message = User.assignUser(parameters)

createPermission

Adds permission.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Responses
A permissions definition - object
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local permission = {
  ["method"] = "GET",
  ["end_point"] = "info/{sn}"
}
response.message = User.createPermission(permission)

createUser

Creates a new user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
name string User name
email string(email) User email
password string User password
Responses
Activation code for the created user - string

Activation code for the created user

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local user = {
  ["email"] = "guest@exosite.com",
  ["name"] = "guest",
  ["password"] = "demo7Password"
}
response.message = User.createUser(user)

createUserData

Adds key values to given user. New keys and initial values should be put as key-value pairs in parameters object. It requires at least one key-value pair.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
Map or key/value properties. Both key and value should be string. Key pattern is [A-Za-z0-9-_]{1,50} - object
Name Type Description
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["nickname"] = "Demo User" -- new key 'nickname'
}
response.message = User.createUserData(parameters)

deassignUser

Deassigns given role from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest"
}
response.message = User.deassignUser(parameters)

deassignUserParam

Deassigns given role with specific parameter value from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
parameter_value string Parameter value
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn",
  ["parameter_value"] = "1"
}
respons.message = User.deassignUserParam(parameters)

deassignUserParamName

Deassigns given role with specific parameter name from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn"
}
response.message = User.deassignUserParamName(parameters)

deletePerm

Deletes given permission.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
perm_id string {method}/{end_point}
Responses
Deletion successful - nil

Deletion successful

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["perm_id"] = "GET/info/{sn}"
}
response.message = User.deletePerm(parameters)

deleteUser

Deletes given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
Deletion successful - nil

Deletion successful

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2
}
response.message = User.deleteUser(parameters)

deleteUserData

Deletes key values from given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
keys [ string ] List of keys
Responses
Map or key/value properties. Both key and value should be string. Key pattern is [A-Za-z0-9-_]{1,50} - object
Name Type Description
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["keys"] = {"country", "nickname"}
}
response.message = User.deleteUserData(parameters)

getCurrentUser

Gets user by given token.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
token string Brearer scheme token authentication defined in https://tools.ietf.org/html/rfc6750
Responses
A user definition - object
Name Type Description
id integer User unique ID
name string User name
email string(email) User email
status integer User status
creation_date integer Creation timestamp
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code

getUser

Gets user by given User ID.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
A user definition - object
Name Type Description
id integer User unique ID
name string User name
email string(email) User email
status integer User status
creation_date integer Creation timestamp
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.getUser({["id"] = 2})

getUserData

Returns the value of given key of given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
key string Data key
Responses
The value of given user data key. - string

The value of given user data key.

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["key"] = "birthday"
}
response.message = User.getUserData(parameters)

getUserToken

Gets user's token by email and password.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
email string(email) User email
password string User password
time_to_live integer {1..} Lifetime of token in minutes
Default: 480
Responses
User authentication token - string

User authentication token

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["email"] = "guest@exosite.com",
  ["password"] = "demo7Password",
  ["time_to_live"] = 60  -- 1 hour
}
response.message = User.getUserToken(parameters)

hasUserPerm

Checks if given user has given permission. If the end_point of given permission includes variable parameters, it requires specific parameter values.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
perm_id string {method}/{end_point}
parameters [ string ] Given specific parameter values if permission (end_point) has parameters. The syntax of each parameter value is '::'.
Responses
Returns "OK" if user has permission - "OK"

Returns "OK" if user has permission

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["perm_id"] = "GET/info/{sn}",
  ["parameters"] = {"sn::1"}
}
response.message = User.hasUserPerm(parameters)

listPerms

Returns the list of permissions.

Responses
List of Permissions - [ object ]
Name Type Description
method ^[A-Z]{1,10}$ Http method of the endpoint
end_point ^[A-Za-z0-9\-\/_{}]{1,150}$ Endpoint path.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.listPerms()

listUserData

Returns key values of given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
Map or key/value properties. Both key and value should be string. Key pattern is [A-Za-z0-9-_]{1,50} - object
Name Type Description
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2
}
response.message = User.listUserData(parameters)

listUserRoleParamValues

Returns the paginated list of values of given parameter name belong to given user role.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
role_id string Role ID
parameter_name string Parameter name
offset integer Pagination offset
limit integer {1..100} Pagination limit
Default: 100
Responses
Operation response object containing one page of user role parameters. - object
Name Type Description
items [ string ] One page list of parameters.
total integer Total number of keys.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["role_id"] = "guest",
  ["parameter_name"] = "sn"
}
response.message = User.listUserRoleParamValues(parameters)

listUserRoles

Returns the list of assigned roles of given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
List of user roles - [ object ]
Name Type Description
role_id ^[A-Za-z0-9\-_]{1,80}$ Case-insensitive unique ID in roles. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters [ object ] List role parameters
parameters[].name ^[A-Za-z]{1,40}$ Case-insensitive unique name in roles parameters. Keywords: me, user(s), permission(s), role(s), parameter(s), group(s), member(s)
parameters[].value ^[A-Za-z0-9]{1,100}$ Parameter value, type might be string or object.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
response.message = User.listUserRoles({["id"] = 2})

listUsers

Returns the list of users. Warning! The original response schema is deprecated and will be removed in the future.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
filter [ string ] Filter to limit the result set. The syntax of each clause is '::like::'.
offset integer Pagination offset
limit integer {1..100} Pagination limit
Default: 100
Responses
Paginated users - object
Name Type Description
items [ object ] List of users
items[].id integer User unique ID
items[].name string User name
items[].email string(email) User email
items[].status integer User status
items[].creation_date integer Creation timestamp
total integer The total number of user items affected by the query.
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
-- To paginate users, 'offset' and 'limit' are both required. This example will return paginated users.
local parameters_1 = {
  ["filter"] = {"email::like::guest", "name::like::guest"},
  ["offset"] = 0,
  ["limit"] = 10
}
response.message = User.listUsers(parameters_1)

-- This example will return users from original response schema - a flat list without being wrapped in 'items'.
local parameters_2 = {
  ["filter"] = {"email::like::guest", "name::like::guest"}
} -- The original response schema is deprecated and will be removed in the future. Please make changes on your current usage by adding input parameters 'offset' and 'limit' always for replacing original response with pagination response.
response.message = User.listUsers(parameters_2)

resetUserPassword

Forces password reset. When a user's password is changed, existing tokens are still valid.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
password ^[\S\s]{8,}$ New password to be set.
Responses
New generated password. - object
Name Type Description
password string New generated password.
Resets successfully. - nil

Resets successfully.

Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["password"] = "newPwd777"
} response.message = User.resetUserPassword(parameters)

updateUser

Updates given user.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
name string User name
status integer {..2} User status. 0: Not Activated 1: Activated 2: Disabled
password string User new password. When a user's password is changed, existing tokens are still valid.
original_password string User original password. Required if updating password.
Responses
A user definition - object
Name Type Description
id integer User unique ID
name string User name
email string(email) User email
status integer User status
creation_date integer Creation timestamp
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["name"] = "newName"
}
response.message = User.updateUser(parameters)

updateUserData

Updates key values of given user. New values of existing keys should be put as key-value pairs in parameters object. It requires at least one key-value pair.

Arguments
parameters - object - Object containing service call parameters.
Name Type Description
id string User ID
Responses
Map or key/value properties. Both key and value should be string. Key pattern is [A-Za-z0-9-_]{1,50} - object
Name Type Description
Operation error details - object
Name Type Description
type string Error type
error string Error message
status integer Response code
Example
local parameters = {
  ["id"] = 2,
  ["country"] = "United States", -- new value 'United States' for existing key 'country'
  ["birthday"] = "1992-08-07" -- new value '1992-08-07' for existing key 'birthday'
}
response.message = User.updateUserData(parameters)

Events


account

This event is triggered by creating/updating/deleting a user or any action causes a change on user-name/user-status/user-password.

Arguments
event - object - Passed info in event 'account'.
Name Type Description
id integer User unique ID
type "CREATE", "UPDATE", "DELETE" User action
email string User email
Example
-- Example of EventHandler script:
-- event --      .type   'CREATE' | 'DELETE' | 'UPDATE' --      .id     User ID --      .email  User email address
if (event.type == 'CREATE') then
  -- handle user create
  -- inform admin via email when a user is created
  local emailData = {
    from = "me@myemail.com",
    to = {
      "admin@email.com"
    },
    subject = "User Creation - "..event.email,
    text = to_json(event),
    html = to_json(event),
    connection = {
      server = "smtp.myemail.com",
      port = 1234,
      user = "me",
      password = "mysecret"
    }
  }
  local result = Email.send(emailData)
end
if (event.type == 'DELETE') then
  -- handle user delete
  -- inform admin via email when a user is updated
  local emailData = {
    from = "me@myemail.com",
    to = {
      "admin@email.com"
    },
    subject = "User Deletion - "..event.email,
    text = to_json(event),
    html = to_json(event),
    connection = {
      server = "smtp.myemail.com",
      port = 1234,
      user = "me",
      password = "mysecret"
    }
  }
  local result = Email.send(emailData)
end
if (event.type == 'UPDATE') then
  -- handle user update
  -- inform admin via email when a user is deleted
  local emailData = {
    from = "me@myemail.com",
    to = {
      "admin@email.com"
    },
    subject = "User Update - "..event.email,
    text = to_json(event),
    html = to_json(event),
    connection = {
      server = "smtp.myemail.com",
      port = 1234,
      user = "me",
      password = "mysecret"
    }
  }
  local result = Email.send(emailData)
end