Commit 2907ba77 authored by Gergely Ujvari's avatar Gergely Ujvari Committed by ujvari

Set annotator.user via watch

parent cfe9fd31
...@@ -34,10 +34,6 @@ class Auth ...@@ -34,10 +34,6 @@ class Auth
# Set the user from the token. # Set the user from the token.
plugins.Auth.withToken (token) => plugins.Auth.withToken (token) =>
_checkingToken = false _checkingToken = false
# Annotator needs to access the user property without the permissions
# plugin and since auth service depends on annotator, the annotator
# service cannot use the auth service
annotator.user = token.userId
@user = token.userId @user = token.userId
$rootScope.$apply() $rootScope.$apply()
...@@ -49,7 +45,6 @@ class Auth ...@@ -49,7 +45,6 @@ class Auth
plugins.Auth?.destroy() plugins.Auth?.destroy()
delete plugins.Auth delete plugins.Auth
annotator.user = null
@user = null @user = null
_checkingToken = false _checkingToken = false
...@@ -60,7 +55,6 @@ class Auth ...@@ -60,7 +55,6 @@ class Auth
onready = => onready = =>
if @user is undefined and not _checkingToken if @user is undefined and not _checkingToken
@user = null @user = null
annotator.user = null
identity.watch {onlogin, onlogout, onready} identity.watch {onlogin, onlogout, onready}
......
...@@ -141,6 +141,10 @@ class AppController ...@@ -141,6 +141,10 @@ class AppController
$scope.$watch 'auth.user', (newVal, oldVal) -> $scope.$watch 'auth.user', (newVal, oldVal) ->
return if newVal is undefined return if newVal is undefined
# Annotator needs to access the user property without the permissions
# plugin and since auth service depends on annotator, the annotator
# service cannot use the auth service
annotator.user = newVal
reset() reset()
$scope.login() if isFirstRun and not (newVal or oldVal) $scope.login() if isFirstRun and not (newVal or oldVal)
......
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