Summary

The assignOrganizationManagementRoleToGroup() mutation assigns an organization management role to a group. The role grants the group administrative control over one or more specified organizations in a multi-organization deployment. To remove the assignment, use unassignOrganizationManagementRoleFromGroup().

Syntax

graphql
assignOrganizationManagementRoleToGroup(
      input: AssignOrganizationManagementRoleToGroupInput!
   ): AssignOrganizationManagementRoleToGroupMutation!

The mutation accepts a single required input argument of type AssignOrganizationManagementRoleToGroupInput!. Provide the group ID, the role ID, and the list of organization IDs to which the assignment applies.

The mutation returns AssignOrganizationManagementRoleToGroupMutation!. The returned object includes a group field of type GroupOrganizationManagementRole with the full role details.

Example

Raw
graphql
mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: "abc123", 
             roleId: "def456",
             organizationIds: ["SINGLE_ORGANIZATION_ID"]} )
       { group { role {displayName, organizationPermissions} } }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  assignOrganizationManagementRoleToGroup(input:  ^
            {groupId: \"abc123\",  ^
             roleId: \"def456\", ^
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} ) ^
       { group { role {displayName, organizationPermissions} } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  assignOrganizationManagementRoleToGroup(input: 
            {groupId: \"abc123\", 
             roleId: \"def456\",
             organizationIds: [\"SINGLE_ORGANIZATION_ID\"]} )
       { group { role {displayName, organizationPermissions} } }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "assignOrganizationManagementRoleToGroup": {
      "group": {
      "role": { 
          displayName": "sales",
          organizationPermissions": [
             "MonitorQueries", 
             "BlockQueries"
             ]
        } 
      }
    }
  }
}

Input Parameters

Provide the group ID, the role ID, and the list of organization IDs to which the assignment applies. Use the roles() query to look up valid role and group IDs.

Table: AssignOrganizationManagementRoleToGroupInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupIdStringyes Preview The unique identifier for the group.
organizationIdsStringyes Preview The unique identifier for the organization.
roleIdStringyes Preview The unique identifier for the role.

Returned Values

The mutation returns an AssignOrganizationManagementRoleToGroupMutation! object. The top-level group field returns a GroupOrganizationManagementRole type with the full role details, including display name, assigned permissions, and associated users.

Table: AssignOrganizationManagementRoleToGroupMutation Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupGroupOrganizationManagementRoleyes Long-Term The organization role to assign to group. See GroupOrganizationManagementRole.

Table: GroupOrganizationManagementRole Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
roleRoleyes Long-Term The management role to assign to the organization or group. See Role.

Table: Role Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
descriptionString  Long-Term A description of the role.
displayNameStringyes Long-Term The display name of the role.
groupsGroupyes Long-Term The groups related to the role. See Group.
groupsCountIntyes Long-Term The number of groups related to the role.
idStringyes Long-Term The unique identifier for the role.
limitInt,    The amount of results to return.
organizationManagementPermissionsOrganizationManagementPermissionyes Long-Term The organization management permissions given to the role. See OrganizationManagementPermission.
organizationPermissionsOrganizationPermissionyes Long-Term The organization permissions given to the role. See OrganizationPermission.
readonlyDefaultRoleReadonlyDefaultRole  Short-Term The read-only default role. This parameter is a preview and subject to change. See ReadonlyDefaultRole.
skipInt):GroupResultSetTypeyes Long-Term The number of results to skip or the offset to use. For instance if implementing pagination, set skip = limit * (page - 1)
systemPermissionsSystemPermissionyes Long-Term The system permissions given to the role. See SystemPermission.
usersUseryes Long-Term A list of users assigned the role. See User.
usersCountIntyes Long-Term The number of users assigned the role.
viewPermissionsPermissionyes Long-Term The view permissions given to the role. See Permission.