Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

A unit must belong to a domain and one domain only. A unit can contain one or many (child) units, but a unit can only belong to one (parent) unit only. In other words, the relationship between units is one-many.

Anchor
_Toc341972388
_Toc341972388
Attributes

Attribute

 

type

 

values

 

default

 

mandate

 

comment

 

name

 

string

 

 

 

 

 

true

 

 

 

description

 

string

 

 

 

 

 

false

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

domain

 

object

 

 

 

 

 

true

 

the domain that the unit belongs to

 

parent

 

object

 

 

 

 

 

true

 

the parent unit

 

hasChildren

 

boolean

 

 

 

 

 

 

 

 

 

children

 

coll

 

 

 

 

 

 

 

 

 

repository

object

 

 

 

 

 

 

 

 

 

radiusProfile

object

 

 

 

 

 

 

 

 

 

policies

 

coll

 

 

 

 

 

 

 

Assigned policies

 

radiusProfile

 

object

 

 

 

 

 

 

 

 

 

radiusAttributes

 

coll

 

 

 

 

 

 

 

 

 

Anchor
_Toc341972389
_Toc341972389
/unit/create

To create a new unit, we must specify the name of the unit and its parent: either a domain or a unit. On success, the method always returns the internal unit id of the newly created unit.
Parameters:
{
"attrs":{list of attribute value pairs}
}
Response:
{
"error":0,
"result":{"id":the id of the newly created unit}
}
Examples:

  1. Creating a top-level unit without parent.

Method:/unit/create
Parameters:
{
"attrs":
{
"name":"sales",
"description":"sales dept.",
"domain.id":2
}
}
Response: {"error":0, "result":{"id":1}}

  1. Creating a sub-level unit by specifying its parent unit.

Method:/unit/create
Parameters:
{
"attrs":
{
"name":"sales - london",
"description":"sales team in London",
"parent.id":1
}
}
Response: {"error":0, "result":{"id":2}}

Anchor
_Toc341972390
_Toc341972390
/unit/search

Examples:

  1. Search units in the entire domain

Wiki Markup
Method:/unit/search
Parameters: 
\{
 "match":
\[
 \[domain.id", "=", 1\],
 \[name", "like", "sales%"\]
\],
 "return":\["name", "id", "domain.id", "parent.id"\],
 "sort":"name",
 "order":"asc",
 "max": 20,
 "offset": 0
\}
Response: 
\{
 "error":0,
"result":
\[
 \{
  "name":"sales",
  "id":"1",
  "domain.id":1,
  "parent.id":null
\},
 \{
  "name":"sales - london",
  "id":"2",
  "domain.id":1,
  "parent.id":1
\},
 \{
...
\}
\]
\}

  1. Search top-level units

Wiki Markup
Method:/unit/search
Parameters: 
\{
 "match":
\[
\[domain.id", "=", 1\]
\[parent.id", "=", null\]
\],
 "return":\["name", "id"\],
 "sort":"name",
 "order":"asc",
 "max": 20,
 "offset": 0
\}
Response: 
\{
 "error":0,
"result":
\[
 \{
  "name":"sales",
  "id":1,
\},
 \{
...
\}
\]
\}
\\

  1. Searchchild units of a specific unit

Wiki Markup
Method:/unit/search
Parameters: 
\{
 "match":
\[
\[domain.id", "=", 1\],
\[parent.id", "=", 2\]
\],
 "return":\["name", "id"\],
 "sort":"name",
 "order":"asc",
 "max": 20,
 "offset": 0
\}
Response: 
\{
 "error":0,
"result":
\[
 \{
  "name":"sales - london",
  "id":2,
\},
 \{
...
\}
\]
\}
\\

Anchor
_Toc341972391
_Toc341972391
/unit/get

Wiki Markup
Method:/unit/get
Parameters: 
\{
 "match":
\[
 \["id", "=", 2\],
\],
 "return":\["name", "id", "domain.id","parent.id"\],
\}
Response: 
\{
 "error":0,
"result":
\{
 "name":"sales - london",
 "id":"2",
 "domain.id":1,
 "parent.id":1
\}
\}

Anchor
_Toc341972392
_Toc341972392
/unit/set

Method:/unit/set
Parameters:
{
"id":1,
"attrs":{"description":"new description"}
}
Response:
{
"error":0
}

Anchor
_Toc341972393
_Toc341972393
/unit/delete

Method:/unit/delete
Parameters:
{
"id":1
}
Response:
{
"error":0
}

Anchor
_Toc341972394
_Toc341972394
/unit/addUsers

Wiki Markup
Method:/unit/addUsers
Parameters: 
\{
 "id":unit_id,
 "users":
\[
 \{id:uid1\},
 \{id:uid2\}
\]
\}
Response: 
\{
 "error":0
\}
\\

Anchor
_Toc341972395
_Toc341972395
/unit/deployTokens

Method:/unit/deployTokens
Parameters:
{
"attrs":
{
"unit.id":unit_id,
"product.id":product_id
}
}
Response:
{
"error":0
}


Other Methods:

  1. applyPolicy(apply/unapply)