mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
feature: New user-specific readOnly
and canCreate
settings (#4370)
Also: * Group the tests for readability. * Factor out some common test setup.
This commit is contained in:
parent
7bd5435f50
commit
bf9d613e95
6 changed files with 260 additions and 155 deletions
|
@ -30,6 +30,7 @@ exports.userCanModify = (padId, req) => {
|
|||
if (!settings.requireAuthentication) return true;
|
||||
const {session: {user} = {}} = req;
|
||||
assert(user); // If authn required and user == null, the request should have already been denied.
|
||||
if (user.readOnly) return false;
|
||||
assert(user.padAuthorizations); // This is populated even if !settings.requireAuthorization.
|
||||
const level = exports.normalizeAuthzLevel(user.padAuthorizations[padId]);
|
||||
assert(level); // If !level, the request should have already been denied.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue