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
|
@ -67,8 +67,12 @@ exports.checkAccess = async function(padID, sessionCookie, token, password, user
|
|||
authLogger.debug('access denied: authentication is required');
|
||||
return DENY;
|
||||
}
|
||||
// Check whether the user is authorized. Note that userSettings.padAuthorizations will still be
|
||||
// populated even if settings.requireAuthorization is false.
|
||||
|
||||
// Check whether the user is authorized to create the pad if it doesn't exist.
|
||||
if (userSettings.canCreate != null && !userSettings.canCreate) canCreate = false;
|
||||
if (userSettings.readOnly) canCreate = false;
|
||||
// Note: userSettings.padAuthorizations should still be populated even if
|
||||
// settings.requireAuthorization is false.
|
||||
const padAuthzs = userSettings.padAuthorizations || {};
|
||||
const level = webaccess.normalizeAuthzLevel(padAuthzs[padID]);
|
||||
if (!level) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue