User Accounts & Access Control

Register User

Creates a user in the organization.

var username string // fill in new user's info here
var password string // fill in new user's info here
var email string // fill in new user's info here
var admin bool // indicate if the new user should be admin here
userID, err := api.RegisterUser(username, password, email, admin)
if err != nil {
log.Printf("failed to Register User: %s", err)
os.Exit(1)
}

This can only be called by an administrator of the organization.

Delete User

Deletes a user in the organization.

var userID string // set user's UserID here
count, err := api.RemoveUser(userID)
if err != nil {
log.Printf("failed to Remove User: %s", err)
os.Exit(1)
}

This can only be called by an administrator of the organization.

List Users

Lists all the users in the organization of the current user.

users, err := ListUsers()
if err != nil {
log.Printf("failed to List Users: %s", err)
os.Exit(1)
}
for i, user := range users {
fmt.Printf("%d | UserName: [%s], UserID: [%s], IsAdmin: [%t]\n--------\n", i, u.UserName, u.UserID, u.IsAdmin)
}

Authentication

Some functions require you to be an administrator to execute, or may grant additional functionality.

Promote User

Promotes a user in the organization to the Administrator level.

var userID string // set user's UserID here
ok, err := api.PromoteUser(userID)
if err != nil {
log.Printf("failed to Promote User: %s", err)
os.Exit(1)
}
fmt.Printf("User [%s] Promoted.\n", userID)

This can only be called by an administrator of the organization.

Demote User

Demotes a user in the organization from the Administrator level.

var userID string // set user's UserID here
ok, err := api.DemoteUser(userID)
if err != nil {
log.Printf("failed to Demote User: %s", err)
os.Exit(1)
}
fmt.Printf("User [%s] Demoted.\n", userID)

You cannot demote a user if they are the last administrator of the organization.

This can only be called by an administrator of the organization.

Get Account Information

Obtain information about the user account.

To be provided