Summary

The assignSystemRoleToGroup() mutation assigns a system role to a group in LogScale. System roles grant organization-wide permissions that apply across all repositories and views. Use this mutation to grant a group elevated system-level access rather than view-specific role bindings.

Syntax

graphql
assignSystemRoleToGroup(
      input: AssignSystemRoleToGroupInput!
   ): AssignSystemRoleToGroupMutation!

The mutation accepts a single required input argument of type AssignSystemRoleToGroupInput!. Provide the groupId and roleId to identify the target group and the system role to assign. Select Show Group Roles Query in the Related section to retrieve these identifiers. See the Input Parameters section for details.

The mutation returns an AssignSystemRoleToGroupMutation! object. This non-nullable return type includes the updated group with its assigned system role. See the Returned Values section for the full field list.

Example

Raw
graphql
mutation {
  assignSystemRoleToGroup(input: 
          { groupId: "abc123", 
            roleId: "def456"} )
     { group { role {id, displayName, viewPermissions} } }
}
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 {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}"
}
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 {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}"
}
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 { ^
  assignSystemRoleToGroup(input:  ^
          { groupId: \"abc123\",  ^
            roleId: \"def456\"} ) ^
     { group { role {id, displayName, viewPermissions} } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}"
}'
    "$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 {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}";
$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 {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}"
}'''

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 {
  assignSystemRoleToGroup(input: 
          { groupId: \"abc123\", 
            roleId: \"def456\"} )
     { group { role {id, displayName, viewPermissions} } }
}"
}
);


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": {
    "assignSystemRoleToGroup": {
      "group": {
        "role": {
          "id": "def456",
          "displayName": "Member",
          "viewPermissions": [
            "ChangeDashboards",
            "ChangeSavedQueries",
            "ChangeTriggers",
            "ChangeFiles",
            "ChangeParsers",
            "ReadAccess"
          ]
        }
      }
    }
  }
}

Input Parameters

Provide the unique identifiers for the system role and the group. Both groupId and roleId are required string values. Use the group() query shown in the Related section to retrieve the identifiers for existing groups and roles.

Table: AssignSystemRoleToGroupInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupIdStringyes Long-Term The unique identifier of the group being assigned.
roleIdStringyes Long-Term The unique identifier of the role being assigned.

Returned Values

The mutation returns the updated group with its newly assigned system role. The returned object includes role identifiers, display names, and the system permissions the role grants.

Table: AssignSystemRoleToGroupMutation Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupGroupSystemRoleyes Long-Term The group for which to assign system role. See GroupSystemRole.

Table: GroupSystemRole Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
roleRoleyes Long-Term A system role of the 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.