Discussions

Ask a Question
Back to All

How to properly use /api/UserSecurity/_execute Role Removal

Hello,

I was using the following payload to try to remove the SysAdmin role from this user.

{
  "$type": "Asi.Soa.Core.DataContracts.GenericExecuteRequest, Asi.Contracts",
  "OperationName": "RemoveUserRoles",
  "EntityTypeName": "UserSecurity",
  "Parameters": {
    "$type": "System.Collections.ObjectModel.Collection`1[[System.Object, mscorlib]], mscorlib",
    "$values": [
      {
        "$type": "System.String",
        "$value": "FAMOR"
      },
      {
        "$type": "System.Collections.Generic.List`1[[Asi.Soa.Membership.DataContracts.User.RoleData, Asi.Contracts]]",
        "$values": [
          {
            "$type": "Asi.Soa.Membership.DataContracts.User.RoleData, Asi.Contracts",
            "RoleName": "SysAdmin"
          }
        ]
      }
    ]
  },
  "ParameterTypeName": {
    "$type": "System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib",
    "$values": [
      "System.String",
      "System.Collections.Generic.List`1[[Asi.Soa.Membership.DataContracts.User.RoleData, Asi.Contracts]]"
    ]
  },
  "UseJson": false
}

However, even though this gives a 200-level response, it did not remove the role, and the response seems to be overall bugged.

This is the response for reference.

{
    "$type": "Asi.Soa.Core.DataContracts.ServiceResponse`1[[Asi.Soa.Membership.DataContracts.User.UserSecurityData, Asi.Contracts]], Asi.Contracts",
    "Result": null,
    "IsSuccessStatusCode": true,
    "Message": null,
    "ReasonPhrase": null,
    "StatusCode": 0,
    "ValidationResults": {
        "$type": "Asi.Soa.Core.DataContracts.ValidationResultsData, Asi.Contracts",
        "Errors": {
            "$type": "Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts",
            "$values": []
        },
        "Warnings": {
            "$type": "Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts",
            "$values": []
        }
    },
    "IsCachedResult": false
}

Let me know if I was doing something wrong.

Best, Andrew Tang

Contact us
Copyright © Advanced Solutions International, All rights reserved.