mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:27:07 +00:00
orgAccess(user, null, op) returns vessel access permissions.
If instead of a project ID, orgAccess receives `null`, it will check permissions against the installation's own vessel rather than against a specific project.
This commit is contained in:
@@ -50,11 +50,16 @@ async function vesselOrganisations (vesselID) {
|
||||
return (await vessel.info(vesselID))?.organisations ?? {};
|
||||
}
|
||||
|
||||
/** Check whether a user has access to the project given by `pid`.
|
||||
*
|
||||
* If `pid` is `null`, check against vessel access.
|
||||
*/
|
||||
async function orgAccess (userOrgs, pid, operation) {
|
||||
const projectOrgs = await projectOrganisations(pid);
|
||||
const itemOrgs = pid === null
|
||||
? await vesselOrganisations()
|
||||
: await projectOrganisations(pid);
|
||||
|
||||
return access(userOrgs, projectOrgs, operation);
|
||||
return access(userOrgs, itemOrgs, operation);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user