|
@@ -16,10 +16,10 @@
|
16
|
16
|
luticateRequest.post("/api/luticate/users/login", data, null, promise)
|
17
|
17
|
.then(function(user)
|
18
|
18
|
{
|
19
|
|
- luticateAuthUsers.loadPermissions(user, promise)
|
|
19
|
+ luticateAuthCache.setUser(user);
|
|
20
|
+ luticateAuthUsers.loadPermissions(promise)
|
20
|
21
|
.then(function(permissions)
|
21
|
22
|
{
|
22
|
|
- luticateAuthCache.setUser(user);
|
23
|
23
|
defer.resolve(user);
|
24
|
24
|
}, function(error)
|
25
|
25
|
{
|
|
@@ -40,7 +40,12 @@
|
40
|
40
|
luticateAuthPermissions.getAllEffectiveMe(promise)
|
41
|
41
|
.then(function(permissions)
|
42
|
42
|
{
|
43
|
|
- luticateAuthCache.setEffectivePermissions(permissions);
|
|
43
|
+ var perms = {};
|
|
44
|
+ for (var i = 0; i < permissions.length; ++i) {
|
|
45
|
+ var p = permissions[i];
|
|
46
|
+ perms[p.Name] = p.Value;
|
|
47
|
+ }
|
|
48
|
+ luticateAuthCache.setEffectivePermissions(perms);
|
44
|
49
|
defer.resolve(permissions);
|
45
|
50
|
}, defer.reject);
|
46
|
51
|
return defer.promise;
|
|
@@ -50,14 +55,11 @@
|
50
|
55
|
{
|
51
|
56
|
var defer = $q.defer();
|
52
|
57
|
luticateRequest.post("/api/luticate/users/logout", null, null, promise)
|
53
|
|
- .then(function(data)
|
|
58
|
+ .finally(function()
|
54
|
59
|
{
|
55
|
60
|
luticateAuthCache.removeUser();
|
56
|
|
- defer.resolve(null);
|
57
|
|
- }, function(error)
|
58
|
|
- {
|
59
|
|
- luticateAuthCache.removeUser();
|
60
|
|
- defer.resolve(null);
|
|
61
|
+ luticateAuthUsers.loadPermissions(promise)
|
|
62
|
+ .finally(defer.resolve);
|
61
|
63
|
});
|
62
|
64
|
return defer.promise;
|
63
|
65
|
};
|