Summary

The changeUserAndGroupRolesForSearchDomain() mutation replaces the role assignments for users and groups on a search domain (a repository or view). The mutation applies both the user and group lists together, replacing whatever role assignments were previously configured. To remove all user or group role assignments from a search domain, pass an empty list for the corresponding parameter. To look up the search domain identifier and the current group and user assignments before calling this mutation, use the searchDomains() query.

Syntax

graphql
changeUserAndGroupRolesForSearchDomain(
      searchDomainId: String!,
      groups: [GroupRoleAssignment!]!,
      users: [UserRoleAssignment!]!
   ): [UserOrGroup!]!

The mutation requires the unique identifier of a search domain and two non-null lists: one for group role assignments and one for user role assignments. Use the searchDomains() query to retrieve the identifiers needed for all three parameters.

The mutation returns a non-null list of UserOrGroup items. Request fields from the Group or User subtypes using inline fragments. See the Returned Values section for details.

Example

Raw
graphql
mutation {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: "aK9GKAsTnMXfRxT8Fpecx3fX",
      groups: [ {groupId: "abc123", 
                 roleId: "def456"} ],
      users:  [ {userId: "ghi789", 
                 roleId: "jkl012"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}
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 {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}"
}
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 {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}"
}
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 { ^
  changeUserAndGroupRolesForSearchDomain( ^
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\", ^
      groups: [ {groupId: \"abc123\",  ^
                 roleId: \"def456\"} ], ^
      users:  [ {userId: \"ghi789\",  ^
                 roleId: \"jkl012\"} ] ) ^
  {... on Group {displayName, userCount} ^
   ... on User {username} } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}"
}'
    "$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 {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}";
$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 {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}"
}'''

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 {
  changeUserAndGroupRolesForSearchDomain(
      searchDomainId: \"aK9GKAsTnMXfRxT8Fpecx3fX\",
      groups: [ {groupId: \"abc123\", 
                 roleId: \"def456\"} ],
      users:  [ {userId: \"ghi789\", 
                 roleId: \"jkl012\"} ] )
  {... on Group {displayName, userCount}
   ... on User {username} }
}"
}
);


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();

Input Parameters

This mutation requires three input parameters. The groups and users parameters use structured input datatypes with their own fields, each described in the tables following this one.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table lists all input parameters for this mutation. The groups and users parameters use structured input datatypes described in the tables following this one.
groups [GroupRoleAssignment!]! yes   The list of group role assignments to apply to the search domain. Each item pairs a group identifier with a role identifier. Pass an empty list to remove all group role assignments.
searchDomainId string yes   The unique identifier of the search domain (repository or view) whose role assignments you want to update.
users [UserRoleAssignment!]! yes   The list of user role assignments to apply to the search domain. Each item pairs a user identifier with a role identifier. Pass an empty list to remove all user role assignments.

The GroupRoleAssignment input datatype requires the unique identifiers of a group and a role. The table following explains its fields:

Table: GroupRoleAssignment Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupIdStringyes Long-Term The unique identifier for the group related to the role.
roleIdStringyes Long-Term The unique identifier of the role.

The UserRoleAssignment input datatype requires the unique identifiers of a user and a role. The table following explains its fields:

Table: UserRoleAssignment Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
roleIdStringyes Long-Term The unique identifier for the role to assign.
userIdStringyes Long-Term The unique identifier of the user for which to assign the role.

Returned Values

The returned datatype, UserOrGroup is a union of two other datatypes: Group and User. Prefix your field selections with an inline fragment using the reserved word on, for example ... on Group. See the Example section for a complete illustration.

To confirm a role change for a group, request fields from Group, for example its current role list. To confirm a role change for a user, request fields from User. The fields available for each subtype are listed in the tables following:

Table: Group Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
assetIdString,yes   Id of the asset
assetTypeAssetPermissionsAssetType,searchDomainId:String):GroupAssetActionsBySourceyes Short-Term The type of the asset.
assetTypesAssetPermissionsAssetType],yes   List of asset types
defaultQueryPrefixString  Long-Term The default prefix for queries.
defaultRoleRole  Long-Term The default role associated with the group. See Role.
defaultSearchDomainCountIntyes Long-Term The default search domain count.
displayNameStringyes Long-Term The display name of the group.
idStringyes Long-Term The identifier of the group.
limitInt,    The amount of results to return.
lookupNameString  Long-Term The look-up name for the group.
orderByOrderBy):UserResultSetTypeyes Long-Term Choose the order in which the results are returned.
organizationRolesGroupOrganizationRoleyes Long-Term The roles of the organization associated with the group. See GroupOrganizationRole.
permissionTypePermissionType  Long-Term Indicates which level of permissions the group contains. See PermissionType .
permissionsAssetAction]):AssetPermissionSearchResultSetyes Short-Term Include Read, Update and/or Delete permission assignments. The filter will accept all assets if the argument Null or the empty list.
rolesSearchDomainRoleyes Long-Term The roles for the group See SearchDomainRole.
searchDomainCountIntyes Long-Term The number of search domains for the group.
searchDomainIdsString],yes   List of search domain id's to search within. Null or empty list is interpreted as all search domains
searchDomainRoles(searchDomainId: String)SearchDomainRoleyes Long-Term The search domain roles assigned to the group. See SearchDomainRole.
searchDomainRolesByName(searchDomainName: String!)SearchDomainRole  Deprecateddeprecated in 1.195

The search domain roles assigned to the group, by name. See SearchDomainRole. When multiple roles per view is enabled, this field will return only the first of possibly multiple roles matching the name for the view.

Use roles, searchDomainRoles, or searchDomainRolesBySearchDomainName fields instead. This field will be removed at the earliest in version 1.195.

searchDomainRolesBySearchDomainName(searchDomainName: String!)SearchDomainRoleyes Long-Term The domain roles by search domain name. See SearchDomainRole.
searchFilterString,    Filter results based on this string
skipInt,    The number of results to skip or the offset to use. For instance if implementing pagination, set skip = limit * (page - 1)
sortByOrderByUserField,    The value to sort the result set by.
systemRolesGroupSystemRoleyes Long-Term The system roles of the group. See GroupSystemRole.
userCountIntyes Long-Term The number of users that are part of the group.
usersUseryes Long-Term The list of users in the group. See User.

Table: User Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedOrganizationActionsOrganizationActionyes Long-Term Returns the actions the user is allowed to perform in the organization. See OrganizationAction .
allowedSystemActionsSystemActionyes Long-Term Returns the actions the user is allowed to perform in the system. See SystemAction Table.
assetIdString,yes   Id of the asset
assetTypeAssetPermissionsAssetType,yes   The type of the asset.
assetTypesAssetPermissionsAssetType],yes   List of asset types
companyString  Long-Term The name of the company for the user account.
countryCodeString  Long-Term The two-letter ISO 3166-1 Alpha-2 code for the country of residence (e.g., us).
createdAtDateTimeyes Long-Term The data and time the account was created.
displayNameStringyes Long-Term The value of the fullName if used, otherwise the username.
emailString  Long-Term The user account's email address for communications from LogScale.
externalUsernameString  Long-Term Readable username for when user stems from Falcon Stability: Long-term
firstNameString  Long-Term The user's actual first name (e.g., Bob). Don't use with fullName.
fullNameString  Long-Term The user's full name (e.g., Bob Smith). Don't use if using other name parameters.
groupSearchDomainRolesGroupSearchDomainRoleyes Long-Term The group search domain roles. See GroupSearchDomainRole.
groupsGroupyes Long-Term The groups of which the user is a member. See Group.
idStringyes Long-Term The identifier or token for the user.
isOrgRootBooleanyes Long-Term Whether the organization is granted organization ownership.
isRootBooleanyes Long-Term Whether the user account is granted root access.
lastNameString  Long-Term The user's actual last name or family name (e.g., Smith). Don't use with fullName.
limitInt,    The amount of results to return.
orderByOrderBy,    Choose the order in which the results are returned.
permissionsAssetAction]):AssetPermissionSearchResultSetyes Short-Term Permissions of the user. See UserPermissions.
phoneNumberString  Long-Term The telephone number for LogScale to use for telephone text messages.
pictureString  Long-Term File name of an image file for the account.
searchDomainIdString):[AssetActionsBySourceyes Short-Term Search domain id
searchDomainIdsString],yes   List of search domain id's to search within. Null or empty list is interpreted as all search domains
searchDomainRoles(searchDomainId: String)SearchDomainRoleyes Long-Term The search domain roles assigned to the user. See SearchDomainRole.
searchDomainRolesByName(searchDomainName: String!)SearchDomainRole  Deprecateddeprecated in 1.195

The search domain roles for the user, by name. See SearchDomainRole.

This field is deprecated because when multiple roles per view is enabled, it will return only the first of possibly multiple roles matching the name for the view. Use instead searchDomainRoles or searchDomainRolesBySearchDomainName.

searchDomainRolesBySearchDomainName(searchDomainName: String!)SearchDomainRoleyes Long-Term The search domain roles assigned to the user by search domain name. See SearchDomainRole.
searchFilterString,    Filter results based on this string
skipInt,searchInRoles:Boolean):GroupResultSetTypeyes Short-Term The number of results to skip or the offset to use. For instance if implementing pagination, set skip = limit * (page - 1)
sortBySortBy,    The sort by options for assets. Asset name is default
stateCodeString  Long-Term The two-letter, ISO 3166-2 country sub-division code for the state of residence (e.g., ny).
usernameStringyes Long-Term The user name for the account.
viewNameString):[UserPermissionsyes Long-Term Exact name of the repo to find permissions for.