This article discusses how to use the ̽»¨´óÉñ API to control User Elevated Permissions at the User Group level and/or at the User Group → Device Group Bind level. The goal is to allow administrators to have better high-level control over the permissions that their users have across devices while minimizing the maintenance overhead that can come with managing User Device permissions on an individual basis.
Elevated Permissions on User Groups
Prerequisites:
- User Group ID (60f84e262921680001dbe9ba in the examples)
- ̽»¨´óÉñ API key (redacted in the examples)
Getting Existing User Group Data
Note that the ̽»¨´óÉñ API currently only supports POST
Ìý²¹²Ô»åÌýPUT
Ìý´Ú´Ç°ùÌýUser Groups
.ÌýPUT
 saves the provided state to the object at the given ID. This means that to modify the attributes field, all User Group
 fields must be included in the request as the object is intended to be saved. Retrieve all other User Group
 fields and attribute properties and include them in the request if the goal is only to modify the sudo
Ìý±è°ù´Ç±è±ð°ù³Ù¾±±ð²õ.
cURL to get data from an existing group:
curl https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY"
Returning something similar to:
{
Ìý"²¹³Ù³Ù°ù¾±²ú³Ü³Ù±ð²õ":µ÷
 "ldapGroups":[
   {
     "name":"MYGROUP"
   }
  ]
Ìý°¨,Ìý
Ìý"¾±»å":"60´Ú84±ð262921680001»å²ú±ð9²ú²¹",
 "name":"My User Group",
Ìý"³Ù²â±è±ð":"³Ü²õ±ð°ù³å²µ°ù´Ç³Ü±è",
Ìý"±ð³¾²¹¾±±ô":"[email protected]",
 "description":"A user group for demonstration",
Ìý"³¾±ð³¾²ú±ð°ù³§³Ü²µ²µ±ð²õ³Ù¾±´Ç²Ô²õ±·´Ç³Ù¾±´Ú²â":´Ú²¹±ô²õ±ð,
Ìý"³¾±ð³¾²ú±ð°ù²Ï³Ü±ð°ù²â":µ÷
  "queryType":"FilterQuery",
  "filters":[
   {
     "field":"company",
     "operator":"eq",
     "value":"MyCompany"
    }
   ]
  }
}
Modifying User Group Elevated Permissions
To elevate permissions for users in this User Group, add the sudo
 property to the attributes
 as below:
"attributes":{
  "ldapGroups":[
     {
        "name":"MYGROUP"
     }
  ]"sudo":{
     "enabled":true,
     "withoutPassword":true
  }
}
Example cURL to elevate permissions for all User
 members of User Group
 to passwordless sudo with the above attributes
 included in the request:
curl -X PUT https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
  Ìý"²¹³Ù³Ù°ù¾±²ú³Ü³Ù±ð²õ":µ÷
ÌýÌýÌýÌýÌýÌý"±ô»å²¹±è³Ò°ù´Ç³Ü±è²õ":°Ú
ÌýÌýÌýÌýÌýÌýÌýÌýÌýµ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"²Ô²¹³¾±ð":"²Ñ³Û³Ò¸é°¿±«±Ê"
ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý±Õ,
ÌýÌýÌýÌýÌýÌý"²õ³Ü»å´Ç":µ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌý"±ð²Ô²¹²ú±ô±ð»å":³Ù°ù³Ü±ð,
ÌýÌýÌýÌýÌýÌýÌýÌýÌý"·É¾±³Ù³ó´Ç³Ü³Ù±Ê²¹²õ²õ·É´Ç°ù»å":³Ù°ù³Ü±ð
ÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌý°¨,
  Ìý"¾±»å":"60´Ú84±ð262921680001»å²ú±ð9²ú²¹",
   "name":"My User Group",
  Ìý"³Ù²â±è±ð":"³Ü²õ±ð°ù³å²µ°ù´Ç³Ü±è",
  Ìý"±ð³¾²¹¾±±ô":"[email protected]",
   "description":"A user group for demonstration",
  Ìý"³¾±ð³¾²ú±ð°ù³§³Ü²µ²µ±ð²õ³Ù¾±´Ç²Ô²õ±·´Ç³Ù¾±´Ú²â":´Ú²¹±ô²õ±ð,
  Ìý"³¾±ð³¾²ú±ð°ù²Ï³Ü±ð°ù²â":µ÷
ÌýÌýÌýÌýÌýÌý"±ç³Ü±ð°ù²â°Õ²â±è±ð":"¹ó¾±±ô³Ù±ð°ù²Ï³Ü±ð°ù²â",
ÌýÌýÌýÌýÌýÌý"´Ú¾±±ô³Ù±ð°ù²õ":°Ú
ÌýÌýÌýÌýÌýÌýÌýÌýÌýµ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"´Ú¾±±ð±ô»å":"³¦´Ç³¾±è²¹²Ô²â",
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"´Ç±è±ð°ù²¹³Ù´Ç°ù":"±ð±ç",
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"±¹²¹±ô³Ü±ð":"²Ñ²â°ä´Ç³¾±è²¹²Ô²â"
ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý±Õ
ÌýÌýÌý°¨
}'
Removing User Group Elevated Permissions
Removing elevated permissions consists of removing the sudo
 property from the User Group
'²õÌýattributes.
Example cURL to remove elevated permissions with sudo
Ìý°ù±ð³¾´Ç±¹±ð»å:
curl -X PUT https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
  Ìý"²¹³Ù³Ù°ù¾±²ú³Ü³Ù±ð²õ":µ÷
ÌýÌýÌýÌýÌýÌý"±ô»å²¹±è³Ò°ù´Ç³Ü±è²õ":°Ú
ÌýÌýÌýÌýÌýÌýÌýÌýÌýµ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"²Ô²¹³¾±ð":"²Ñ³Û³Ò¸é°¿±«±Ê"
ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý±Õ
ÌýÌýÌý°¨,
  Ìý"¾±»å":"60´Ú84±ð262921680001»å²ú±ð9²ú²¹",
   "name":"My User Group",
  Ìý"³Ù²â±è±ð":"³Ü²õ±ð°ù³å²µ°ù´Ç³Ü±è",
  Ìý"±ð³¾²¹¾±±ô":"[email protected]",
   "description":"A user group for demonstration",
  Ìý"³¾±ð³¾²ú±ð°ù³§³Ü²µ²µ±ð²õ³Ù¾±´Ç²Ô²õ±·´Ç³Ù¾±´Ú²â":´Ú²¹±ô²õ±ð,
  Ìý"³¾±ð³¾²ú±ð°ù²Ï³Ü±ð°ù²â":µ÷
ÌýÌýÌýÌýÌýÌý"±ç³Ü±ð°ù²â°Õ²â±è±ð":"¹ó¾±±ô³Ù±ð°ù²Ï³Ü±ð°ù²â",
ÌýÌýÌýÌýÌýÌý"´Ú¾±±ô³Ù±ð°ù²õ":°Ú
ÌýÌýÌýÌýÌýÌýÌýÌýÌýµ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"´Ú¾±±ð±ô»å":"³¦´Ç³¾±è²¹²Ô²â",
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"´Ç±è±ð°ù²¹³Ù´Ç°ù":"±ð±ç",
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"±¹²¹±ô³Ü±ð":"²Ñ²â°ä´Ç³¾±è²¹²Ô²â"
ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý±Õ
ÌýÌýÌý°¨
}'
Again, the entirety of the group's properties is included except for the modified attributes
 which no longer include the sudo
Ìý±è°ù´Ç±è±ð°ù³Ù²â:
"attributes":{
ÌýÌýÌýÌýÌýÌý"±ô»å²¹±è³Ò°ù´Ç³Ü±è²õ":°Ú
ÌýÌýÌýÌýÌýÌýÌýÌýÌýµ÷
ÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌýÌý"²Ô²¹³¾±ð":"²Ñ³Û³Ò¸é°¿±«±Ê"
ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý±Õ
ÌýÌýÌý°¨
Verifying User Group Elevated Permissions
POST
ing andPUT
ing groups returns the saved object, allowing for inspection of the response for confirmation.
Elevated Permissions User Group → Device Group Associations
Prerequisites:
- User Group ID (60f84e262921680001dbe9ba for the example)
- Device Group ID (60d9f2c796021e000117f31a for the example)
- ̽»¨´óÉñ API Key (redacted for the example)
Creating User Group → Device Group Associations
cURL for creating a new User Group → Device Group association with elevated permissions:
- This example sets the elevated permissions toÂ
passwordless sudo.
curl -X POST https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba/associations \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
        "op": "add",
        "type": "system_group",
        "id": "60d9f2c796021e000117f31a",
        "attributes": {
          "sudo": {
            "enabled": true,
            "withoutPassword": true
 ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
  ÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý°¨'
Removing User Group → Device Group Associations
cURL for removing a User Group → Device Group association:
curl -X POST https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba/associations \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
        "op": "remove",
        "type": "system_group",
        "id": "60d9f2c796021e000117f31a"
ÌýÌýÌýÌýÌýÌý°¨'
Modifying Existing User Group → Device Group Associations
cURL for modifying elevated permissions on an existing User Group → Device Group association:
- This example sets the elevated permissions toÂ
sudo.
curl -X POST https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba/associations \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
        "op": "update",
        "type": "system_group",
        "id": "60d9f2c796021e000117f31a",
        "attributes": {
          "sudo": {
            "enabled": true,
            "withoutPassword": false
 ÌýÌýÌýÌýÌýÌýÌýÌýÌý°¨
  ÌýÌýÌýÌýÌýÌý°¨
ÌýÌýÌýÌýÌýÌý°¨'
cURL for removing elevated permissions on an existing User Group → Device Group association:
curl -X POST https://console.jumpcloud.com/api/v2/usergroups/60f84e262921680001dbe9ba/associations \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY" \
  -d '{
        "op": "update",
        "type": "system_group",
        "id": "60d9f2c796021e000117f31a",
        "attributes": {}
ÌýÌýÌýÌýÌýÌý°¨'
Again, note that this was accomplished by removing the sudo
property from the attributes.
Verifying User Group → Device Group Association Permissions
- cURL for retrieving User Groups → Device Groups (referred to asÂ
system_group
 in the API) associations:
curl \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $JC_API_KEY"
Returning something similar:
[
ÌýÌýµ÷
    "attributes": {
      "sudo": {
        "withoutPassword": true,
        "enabled": true
ÌýÌýÌýÌýÌýÌý°¨
 ÌýÌýÌý°¨,
    "to": {
      "attributes": null,
      "id": "60d9f2c796021e000117f31a",
      "type": "system_group"
 ÌýÌýÌý°¨
ÌýÌý°¨
]
- In this case, the returned JSON indicates that the group hasÂ
passwordless sudo
 elevated permissions to theÂsystem_group
 with idÂ60d9f2c796021e000117f31a.
The response from the /associations
 endpoint is a list of Device Groups, so it may return many associations that may need to be inspected to confirm elevated permissions for a specific group.
Permission Caveats
- It is recommended to have the
sudo
property as one of two states (below). - If no elevated permissions are desired, it is advisable to remove theÂ
sudo
 attribute entirely from theÂattributes
Ìý´Ç²úÂá±ð³¦³Ù.
"sudo":{
ÌýÌýÌýÌý"±ð²Ô²¹²ú±ô±ð»å":³Ù°ù³Ü±ð,
ÌýÌýÌýÌý"·É¾±³Ù³ó´Ç³Ü³Ù±Ê²¹²õ²õ·É´Ç°ù»å":´Ú²¹±ô²õ±ð
ÌýÌý°¨
Passwordless sudo:
"sudo":{
ÌýÌýÌýÌý"±ð²Ô²¹²ú±ô±ð»å":³Ù°ù³Ü±ð,
ÌýÌýÌýÌý"·É¾±³Ù³ó´Ç³Ü³Ù±Ê²¹²õ²õ·É´Ç°ù»å":³Ù°ù³Ü±ð
ÌýÌý°¨