Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: spo roledefinition list #3237

Closed
Adam-it opened this issue Apr 17, 2022 · 6 comments
Closed

New command: spo roledefinition list #3237

Adam-it opened this issue Apr 17, 2022 · 6 comments
Assignees
Milestone

Comments

@Adam-it
Copy link
Contributor

Adam-it commented Apr 17, 2022

Usage

m365 spo roledefinition list

Description

should retrieve list of role definitions from web

Options

Option Description
-u, --webUrl <webUrl> URL of the site from which the list of roles should be retreived

Additional Info

managing role definitions (for now listing and getting single role will be enough but there is room for additional commands here 😉) is the second step before we start adding some commands which will allow to manage permissions on items (add/remove roles etc.) which is what I would like to aim as described here #3184.

getting the list of role definitions from site may be done using simple GET request
/_api/web/roledefinitions

So when running this request for web with the following roles
image

the result is

{
  "value": [
    {
      "BasePermissions": {
        "High": "2147483647",
        "Low": "4294967295"
      },
      "Description": "Has full control.",
      "Hidden": false,
      "Id": 1073741829,
      "Name": "Full Control",
      "Order": 1,
      "RoleTypeKind": 5
    },
    {
      "BasePermissions": {
        "High": "432",
        "Low": "1012866047"
      },
      "Description": "Can view, add, update, delete, approve, and customize.",
      "Hidden": false,
      "Id": 1073741828,
      "Name": "Design",
      "Order": 32,
      "RoleTypeKind": 4
    },
    {
      "BasePermissions": {
        "High": "432",
        "Low": "1011030767"
      },
      "Description": "Can add, edit and delete lists; can view, add, update and delete list items and documents.",
      "Hidden": false,
      "Id": 1073741830,
      "Name": "Edit",
      "Order": 48,
      "RoleTypeKind": 6
    },
    {
      "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
    },
    {
      "BasePermissions": {
        "High": "176",
        "Low": "138612833"
      },
      "Description": "Can view pages and list items and download documents.",
      "Hidden": false,
      "Id": 1073741826,
      "Name": "Read",
      "Order": 128,
      "RoleTypeKind": 2
    },
    {
      "BasePermissions": {
        "High": "65584",
        "Low": "134418433"
      },
      "Description": "Can view pages, list items, and documents. Documents can be viewed in the browser but not downloaded.",
      "Hidden": true,
      "Id": 1073741832,
      "Name": "Restricted View",
      "Order": 144,
      "RoleTypeKind": 8
    },
    {
      "BasePermissions": {
        "High": "48",
        "Low": "134287360"
      },
      "Description": "Can view specific lists, document libraries, list items, folders, or documents when given permissions.",
      "Hidden": true,
      "Id": 1073741825,
      "Name": "Limited Access",
      "Order": 160,
      "RoleTypeKind": 1
    },
    {
      "BasePermissions": {
        "High": "48",
        "Low": "134418465"
      },
      "Description": null,
      "Hidden": true,
      "Id": 1073741924,
      "Name": "System.LimitedView",
      "Order": 2147483647,
      "RoleTypeKind": 255
    },
    {
      "BasePermissions": {
        "High": "48",
        "Low": "134418471"
      },
      "Description": null,
      "Hidden": true,
      "Id": 1073741925,
      "Name": "System.LimitedEdit",
      "Order": 2147483647,
      "RoleTypeKind": 255
    },
    {
      "BasePermissions": {
        "High": "0",
        "Low": "198919"
      },
      "Description": "",
      "Hidden": false,
      "Id": 1073741926,
      "Name": "custom",
      "Order": 2147483647,
      "RoleTypeKind": 0
    }
  ]
}
@Adam-it
Copy link
Contributor Author

Adam-it commented Apr 17, 2022

ok one comment here (mainly for me 😉) TBH I did not double checked if maybe this information may already be retrieved using MS Graph instead of SP rest API. I will need to check this and if not, what I suggested above is ok 😊. At least I hope so 🤔

@waldekmastykarz
Copy link
Member

Thank you for the spec! A couple of comments:

  • let's align the naming convention with our comments and adjust the last noun to singular, so: spo roledefinition list
  • which properties would you recommend to display by default in the text mode?
  • I don't think this information is exposed through Graph so using the API you mentioned is ok

@Adam-it
Copy link
Contributor Author

Adam-it commented Apr 18, 2022

  • ✅ aligned command to singular
  • I would show only Id, Name, Description (even this is optional I think as it may be quite long sometimes) nothing more
  • yes this also what I expected but just wanted to double check to be sure 😉. Ok but lets use the suggested API.

BTW thanks for the quick response and feedback during easter time 👍. Seems like you are always available 😊. You rock 👍

@waldekmastykarz
Copy link
Member

Thank you for a quick turnaround! Would you like to pick it up yourself or let others help?

@Adam-it
Copy link
Contributor Author

Adam-it commented Apr 18, 2022

I can give it a shot, let's not keep this one waiting.

@waldekmastykarz
Copy link
Member

All yours! Thank you! 👏

@Adam-it Adam-it changed the title New command: spo list role definitions New command: spo roledefinition list May 1, 2022
@waldekmastykarz waldekmastykarz added this to the v5.3 milestone May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants