mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
22 lines
No EOL
691 B
CoffeeScript
22 lines
No EOL
691 B
CoffeeScript
define [], () ->
|
|
class PermissionsManager
|
|
constructor: (@ide, @$scope) ->
|
|
@$scope.permissions =
|
|
read: false
|
|
write: false
|
|
admin: false
|
|
@$scope.$watch "permissionsLevel", (permissionsLevel) =>
|
|
|
|
if permissionsLevel?
|
|
if permissionsLevel == "readOnly"
|
|
@$scope.permissions.read = true
|
|
else if permissionsLevel == "readAndWrite"
|
|
@$scope.permissions.read = true
|
|
@$scope.permissions.write = true
|
|
else if permissionsLevel == "owner"
|
|
@$scope.permissions.read = true
|
|
@$scope.permissions.write = true
|
|
@$scope.permissions.admin = true
|
|
|
|
@$scope.hasPermission = (requestedLevel)=>
|
|
return @$scope.permissions[requestedLevel] |