grommunio / admin-api

Management REST API for grommunio
GNU Affero General Public License v3.0
6 stars 13 forks source link

exmdb user@domain.tld folder permissions [FolderID | --recursive] --format json-tree #12

Open crpb opened 1 year ago

crpb commented 1 year ago

In reference to #5 it would be nice to have the possibility to get those extended formats also with the command in the topic and even better would be the possibility to list all non-default permissions for user@domain.tld on the mailbox recursively. This would make things like problem-solving(because of wrong permissions) and even an "Audit" much easier.

I know i can read all those entries from the sqlite-db's but i think this would be nice to access it via the the cli or at a later point even with the webapi.

For now i scribbled together the following to retrieve a quick overview.

I also looked a bit at ./cli/exmdb.py but wasn't really sure how to best implement the return of the permissions. Maybe something like this?

{
  "folders": [
    {
      "ID": 9,
      "parentID": 1,
      "name": "Top of Information Store",
      "subfolders": [...],
      "permissions": [
        {
          "user": "mbx1@domain.tld",
          "perms": "0x2000"
        },
        {
// Alternatively
          "user": "mbx2@domain.tld",
          "numeric": "0x041b",
          "permissions": "readany,create,editowned,deleteowned,foldervisible"
\\ Alternatively
        },
        ...
      ]
    },
  ],
  "permissions": [
    {
      "readany": "0x1",
      "create": "0x2",
      "sendas": "0x4",
      "editowned": "0x8",
      "deleteowned": "0x10",
      "editany": "0x20",
      "deleteany": "0x40",
      "createsubfolder": "0x80",
      "folderowner": "0x100",
      "foldercontact": "0x200",
      "foldervisible": "0x400",
      "freebusysimple": "0x800",
      "freebusydetailed": "0x1000",
      "storeowner": "0x2000"
    }
  ]
}

The extra "permissions" might also be requested with an additional switch and by default not be returned depending on the return i guess not needed anyhow.

~crpb

crpb commented 3 months ago

Well, for now i can retrieve a the configured permissions with this w/o waiting on grommunio-admin to get loop over everything. 🙈