Commit cfe9fd31 authored by Gergely Ujvari's avatar Gergely Ujvari Committed by ujvari

Move group:__world__ to a constant

parent 18166dbe
###* ###*
# @ngdoc service # @ngdoc service
# @name Permissions # @name Permissions
...@@ -7,6 +8,8 @@ ...@@ -7,6 +8,8 @@
# offers some utility functions regarding those. # offers some utility functions regarding those.
### ###
class Permissions class Permissions
GROUP_WORLD = 'group:__world__'
this.$inject = ['auth'] this.$inject = ['auth']
constructor: (auth) -> constructor: (auth) ->
###* ###*
...@@ -33,7 +36,7 @@ class Permissions ...@@ -33,7 +36,7 @@ class Permissions
### ###
@public = -> @public = ->
return { return {
read: ['group:__world__'] read: [GROUP_WORLD]
update: [auth.user] update: [auth.user]
delete: [auth.user] delete: [auth.user]
admin: [auth.user] admin: [auth.user]
...@@ -49,7 +52,7 @@ class Permissions ...@@ -49,7 +52,7 @@ class Permissions
# visible(readable) or not. # visible(readable) or not.
### ###
isPublic: (annotation) -> isPublic: (annotation) ->
'group:__world__' in (annotation.permissions?.read or []) GROUP_WORLD in (annotation.permissions?.read or [])
###* ###*
# @ngdoc method # @ngdoc method
...@@ -72,7 +75,7 @@ class Permissions ...@@ -72,7 +75,7 @@ class Permissions
for token in tokens for token in tokens
if user == token if user == token
return true return true
if token == 'group:__world__' if token == GROUP_WORLD
return true return true
# No tokens matched: action should not be performed. # No tokens matched: action should not be performed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment