-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from assemblee-virtuelle/PermissionsManagement
[Minor] Resources permissions management
- Loading branch information
Showing
7 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Resources permissions | ||
|
||
New resources created have permissions by default for anonymous users, auuthenticated users, and resource creator. | ||
|
||
Default permissions are summarized in the following table: | ||
|
||
| Users | Read permission | Write permission | Control permission | ||
|---------------------|-----------------|------------------|------------------- | ||
| Anonymous users | true | false | false | ||
| Authenticated users | true | false | false | ||
| Resource creator | true | true | true | ||
|
||
If you want to change these permissions, you can define the following environment variables for the middleware: | ||
|
||
- `SEMAPPS_RESOURCESPERMISSIONS_ANON_READ`: false/true for anonymous users read permissions | ||
- `SEMAPPS_RESOURCESPERMISSIONS_ANYUSER_READ`: false/true for authenticated users read permissions | ||
- `SEMAPPS_RESOURCESPERMISSIONS_ANYUSER_WRITE`: false/true for authenticated users write permissions | ||
|
||
Resource creator permissions cannot be modified, as well as control permissions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require('dotenv-flow').config(); | ||
|
||
const getDefaultRights = (creatorUri) => { | ||
return { | ||
anon : { | ||
read: !(process.env.SEMAPPS_RESOURCESPERMISSIONS_ANON_READ === 'false'), | ||
}, | ||
anyUser: { | ||
read: !(process.env.SEMAPPS_RESOURCESPERMISSIONS_ANYUSER_READ === 'false'), | ||
write: process.env.SEMAPPS_RESOURCESPERMISSIONS_ANYUSER_WRITE === 'true', | ||
}, | ||
user: { | ||
uri: creatorUri, | ||
read: true, | ||
write: true, | ||
control : true | ||
} | ||
} | ||
}; | ||
|
||
module.exports = { | ||
getDefaultRights, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters