Dandelion - API Documentation - Rights

Module name: groups

Index

getlist

Endpoint: /api/groups/getlist

Method: GET

Parameters: None

Description: Get list of group names and their IDs.

Example Return Data:

{
	"data": [
		{
			"id": "1",
			"name": "user"
		},
		{
			"id": "2",
			"name": "admin"
		},
		{
			"id": "3",
			"name": "guest"
		}
	]
}

Returned Values:

  • id (int) - ID of group, used to get the permissions with getgroup
  • name (string) - Name of group

Permissions Needed:

  • None

⇑ Top


getgroup

Endpoint: /api/groups/getgroup

Method: GET

Parameters: groupid

Parameter Type Default Required
groupid int   true

Description: Get array of permissions for group

Example Return Data:

{
	"data": {
		"id": "3",
		"name": "guest",
		"permissions": {
			"createlog": false,
			"editlog": false,
			... (see full list below)
		}
		"permissionNames": {
			"createlog": "Create a log entry",
			"editlog": "Edit any log entry",
			...
		}
	}
}

Returned Values:

  • id (int) - ID of group, used to get the permissions with getgroup
  • name (string) - Name of group
  • permissions (array) - Keyed array of permission names and their values
  • permissionNames (array) - Keyed array of human readable permission names keyed to their respecive permission

Permissions Needed:

  • None

⇑ Top


create

Endpoint: /api/groups/create

Method: POST

Parameters: name, rights

Parameter Type Default Required
name string   true
rights string   false

Description: Create a new group named name and assign it the permissions rights. rights is a stringified JSON object with the format as returned by the getuserrights endpoint. If rights is omitted, the group is blank meaning it has no permission set to true by default.

Example Return Data:

{
	"data": "Success or error message"
}

Returned Values:

  • data (string) - User displayable string if the creation was successful or not

Permissions Needed:

  • Create group

⇑ Top


edit

Endpoint: /api/groups/edit

Method: POST

Parameters: groupid, rights

Parameter Type Default Required
groupid int   true
rights string   true

Description: Edit groupid and assign it the permissions rights. rights is a stringified JSON object with the format as returned by the getuserrights endpoint.

Example Return Data:

{
	"data": "Success or error message"
}

Returned Values:

  • data (string) - User displayable string if the save was successful or not

Permissions Needed:

  • Edit group

⇑ Top


delete

Endpoint: /api/groups/delete

Method: POST

Parameters: groupid

Parameter Type Default Required
groupid int   true

Description: Delete group groupid

Example Return Data:

{
	"data": "Success or error message"
}

Returned Values:

  • data (string) - User displayable string if the delete was successful or not

Permissions Needed:

  • Delete group

⇑ Top


getuserrights

Endpoint: /api/groups/getuserrights

Method: GET

Parameters: None

Description: Get permissions for current user (user of key).

Example Return Data:

{
	"data": {
		"createlog": false,
		"editlog": false,
		... (see full list below)
	}
}

Returned Values:

  • permissions (array) - Keyed array of permission names and their values

Permissions Needed:

  • None

⇑ Top


Full permission list:

  • “createlog”: false
  • “editlog”: false
  • “viewlog”: true
  • “createcat”: false
  • “editcat”: false
  • “deletecat”: false
  • “createuser”: false
  • “edituser”: false
  • “deleteuser”: false
  • “creategroup”: false
  • “editgroup”: false
  • “deletegroup”: false
  • “viewcheesto”: true
  • “updatecheesto”: false
  • “admin”: false

⇐ API Documentation