Skip to content

Enhancement to spo roledefinition list command #3824

@Adam-it

Description

@Adam-it

🤔 Problem

The problem we have currently is that when we run the spo roledefinition list command the output values are not really user friendly. I mean the given values are not readable for human and therefore without additional checking in MS SPO docs they don't give any value. This is of course the OOTB api response but still it could be improved.

part of current output

...
{
    "BasePermissions": {
      "High": "32767",
      "Low": "65535"
    },
    "Description": "asodasi",
    "Hidden": false,
    "Id": 1073741936,
    "Name": "aaa",
    "Order": 2147483647,
    "RoleTypeKind": 0
  }
...

the RoleTypeKind property and BasePermissions don't really say much😜.

🎯 Aim

The aim of this issue would be adding to the command additional code which will 'translate' the numeric values to their enum/name equivalents

example of a response

{
  "BasePermissions": {
    "High": "432",
    "Low": "1011028719"
  },
  "Description": "Can view, add, update, and delete list items and documents.",
  "Hidden": false,
  "Id": 1073741827,
  "Name": "Contribute",
  "Order": 64,
  "RoleTypeKind": 3,
  "BasePermissionsValue": [
    "ViewListItems",
    "AddListItems",
    "EditListItems",
    "DeleteListItems",
    "OpenItems",
    "ViewVersions",
    "DeleteVersions",
    "ManagePersonalViews",
    "ViewFormPages",
    "Open",
    "ViewPages",
    "CreateSSCSite",
    "BrowseDirectories",
    "BrowseUserInfo",
    "AddDelPrivateWebParts",
    "UpdatePersonalWebParts",
    "UseClientIntegration",
    "UseRemoteAPIs",
    "CreateAlerts",
    "EditMyUserInfo"
  ],
  "RoleTypeKindValue": "Contributor"
}

so additionally, we should include RoleTypeKindValue property and BasePermissionsValue

💡 How

This is quite easy and already done in the spo roledefinition get command, so the contributor could really base on code we already have 👍👍👍.
We should

...
import { BasePermissions } from '../../base-permissions';
import { RoleType } from './RoleType';

const permissions: BasePermissions = new BasePermissions(); // create a new BasePermissions
permissions.high = response.BasePermissions.High as number;
permissions.low = response.BasePermissions.Low as number;
response.BasePermissionsValue = permissions.parse(); // parse it to get the collection
response.RoleTypeKindValue = RoleType[response.RoleTypeKind]; // get the enum value of the role type
...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions