mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add more commentary on the anonymous path
This commit is contained in:
parent
e73de3bfd4
commit
ad68adee9a
1 changed files with 7 additions and 0 deletions
|
@ -34,17 +34,24 @@ module.exports = AuthorizationManager =
|
||||||
AuthorizationManager.getPublicAccessLevel project_id, (err, publicAccessLevel) ->
|
AuthorizationManager.getPublicAccessLevel project_id, (err, publicAccessLevel) ->
|
||||||
return callback(err) if err?
|
return callback(err) if err?
|
||||||
if publicAccessLevel == PublicAccessLevels.TOKEN_BASED
|
if publicAccessLevel == PublicAccessLevels.TOKEN_BASED
|
||||||
|
# Anonymous users can have read-only access to token-based projects,
|
||||||
|
# while read-write access must be logged in
|
||||||
TokenAccessHandler.requestHasReadOnlyTokenAccess req, project_id, (err, allowed) ->
|
TokenAccessHandler.requestHasReadOnlyTokenAccess req, project_id, (err, allowed) ->
|
||||||
return callback(err) if err?
|
return callback(err) if err?
|
||||||
if allowed
|
if allowed
|
||||||
|
# Grant anonymous user read-only access
|
||||||
callback null, PrivilegeLevels.READ_ONLY, false
|
callback null, PrivilegeLevels.READ_ONLY, false
|
||||||
else
|
else
|
||||||
|
# Deny anonymous user access
|
||||||
callback null, PrivilegeLevels.NONE, false
|
callback null, PrivilegeLevels.NONE, false
|
||||||
else if publicAccessLevel == PublicAccessLevels.READ_ONLY
|
else if publicAccessLevel == PublicAccessLevels.READ_ONLY
|
||||||
|
# Legacy public read-only access for anonymous user
|
||||||
callback null, PrivilegeLevels.READ_ONLY, true
|
callback null, PrivilegeLevels.READ_ONLY, true
|
||||||
else if publicAccessLevel == PublicAccessLevels.READ_AND_WRITE
|
else if publicAccessLevel == PublicAccessLevels.READ_AND_WRITE
|
||||||
|
# Legacy public read-write access for anonymous user
|
||||||
callback null, PrivilegeLevels.READ_AND_WRITE, true
|
callback null, PrivilegeLevels.READ_AND_WRITE, true
|
||||||
else
|
else
|
||||||
|
# Deny anonymous user access
|
||||||
callback null, PrivilegeLevels.NONE, false
|
callback null, PrivilegeLevels.NONE, false
|
||||||
else
|
else
|
||||||
# User is present, get their privilege level from database
|
# User is present, get their privilege level from database
|
||||||
|
|
Loading…
Reference in a new issue