Constructor
new User(name, password, first_name, last_name, email, phone, rolesopt, git_user_credentialsopt)
constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | user's name | |
password |
string | user's password | |
first_name |
string | user's first name | |
last_name |
string | user's last name | |
email |
string | user's email | |
phone |
string | user's phone number | |
roles |
Array.<UserRole> |
<optional> |
user's roles |
git_user_credentials |
Array.<GitUserCredential> |
<optional> |
Git user's credentials |
- Source:
Methods
(static) from(obj) → {User}
Build a User instance from an object, convenient for transportation with a transport protocol, that looks like a user
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | an object |
- Source:
Returns:
an instance of User
- Type
- User
find_git_user_credential(git_remote_url) → {GitUserCredential}
Find Git user's credential bu Git remote URL
Parameters:
Name | Type | Description |
---|---|---|
git_remote_url |
string | Git remote URL |
- Source:
Returns:
a GitUserCredential instance
- Type
- GitUserCredential
get_db_names() → {Array.<string>}
Get databases names where user has a role
- Source:
Returns:
an array of database names
- Type
- Array.<string>
grant(db, role)
Grant a role in a database
Parameters:
Name | Type | Description |
---|---|---|
db |
string | database name |
role |
string | role name |
- Source:
grant_admin_role()
Grant admin role
- Source:
grant_user_role(db)
Grant user role
Parameters:
Name | Type | Description |
---|---|---|
db |
string | database name |
- Source:
has_role(db, roleopt) → {boolean}
Check if user has a particular role in a database
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
db |
string | database name | |
role |
string |
<optional> |
role name |
- Source:
Returns:
whether user has a role in database
- Type
- boolean
is_admin()
Test for admin role
- Source:
revoke(dbopt, roleopt)
Revoke a role in a database
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
db |
string |
<optional> |
database name |
role |
string |
<optional> |
role name |
- Source:
revoke_admin_role()
Revoke admin role
- Source:
revoke_user_role(db)
Grant user role
Parameters:
Name | Type | Description |
---|---|---|
db |
string | database name |
- Source: