Summary

The unassignUserRoleForSearchDomain() mutation removes one or all roles from a user in a specific repository or view. Provide roleId to remove a targeted role. Omit roleId to remove all roles for the user in the search domain. To assign roles instead, call assignUserRolesInSearchDomain().

Syntax

graphql
unassignUserRoleForSearchDomain(
      userId: String!,
      searchDomainId: String!,
      roleId: String
   ): User!

Provide the unique identifiers for the user and the repository or view. The roleId argument is optional. When specified, the mutation removes only that role from the user in the search domain. When omitted, the mutation removes all roles for the user in the search domain. The mutation returns the updated User object.

The returned User type includes standard account fields such as name and email address, as well as data about user permissions, group memberships, and asset access.

Example

Raw
graphql
mutation {
  unassignUserRoleForSearchDomain(
     userId: "abc123",
     searchDomainId: "def456",
     roleId: "ghi789"
  )
    { 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 {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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 {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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 { ^
  unassignUserRoleForSearchDomain( ^
     userId: \"abc123\", ^
     searchDomainId: \"def456\", ^
     roleId: \"ghi789\" ^
  ) ^
    { username } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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 {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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 {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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 {
  unassignUserRoleForSearchDomain(
     userId: \"abc123\",
     searchDomainId: \"def456\",
     roleId: \"ghi789\"
  )
    { 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();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "unassignUserRoleForSearchDomain": {
      "username": "bob"
    }
  }
}

Input parameters

Provide the unique identifiers for the repository or view and the user. The roleId argument is optional. The searchDomains() query returns users and their roles for each search domain.

Table: Input parameters and datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
roleId String     The unique identifier of the role to remove. When specified, only that role is removed from the user in the search domain. When omitted, all roles for the user in the search domain are removed.
searchDomainId String yes   The unique identifier of the repository or view from which the role is removed.
userId String yes   The unique identifier of the user account whose role is being removed.

Returned values

The mutation returns the updated User object. The returned type includes standard account fields such as name and email address, as well as data about user permissions, group memberships, and asset access. Select the datatype links in the following table to see all available sub-fields.

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.