Browse Source

permissions helper; users edit me

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
7a164dff40
2 changed files with 33 additions and 0 deletions
  1. 13
    0
      src/cache.js
  2. 20
    0
      src/users.js

+ 13
- 0
src/cache.js View File

55
                 return value == null ? null : value;
55
                 return value == null ? null : value;
56
             };
56
             };
57
 
57
 
58
+            luticateAuthCache.hasAllEffectivePermissions = function(permission_names)
59
+            {
60
+                return !permission_names.some(function(permission_name)
61
+                {
62
+                    return !luticateAuthCache.hasEffectivePermission(permission_name);
63
+                });
64
+            };
65
+
66
+            luticateAuthCache.hasOneEffectivePermission = function(permission_names)
67
+            {
68
+                return permission_names.some(luticateAuthCache.hasEffectivePermission);
69
+            };
70
+
58
             luticateAuthCache.removeEffectivePermissions = function()
71
             luticateAuthCache.removeEffectivePermissions = function()
59
             {
72
             {
60
                 localStorageService.remove('lu_effective_permissions');
73
                 localStorageService.remove('lu_effective_permissions');

+ 20
- 0
src/users.js View File

69
                     return luticateRequest.get("/api/luticate/users", data, promise);
69
                     return luticateRequest.get("/api/luticate/users", data, promise);
70
                 };
70
                 };
71
 
71
 
72
+                luticateAuthUsers.get = function(data, promise)
73
+                {
74
+                    return luticateRequest.get("/api/luticate/users/" + data.user_id, null, promise);
75
+                };
76
+
77
+                luticateAuthUsers.getMe = function(promise)
78
+                {
79
+                    return luticateRequest.get("/api/luticate/users/me", null, promise);
80
+                };
81
+
72
                 luticateAuthUsers.edit = function(data, promise)
82
                 luticateAuthUsers.edit = function(data, promise)
73
                 {
83
                 {
74
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/edit", data, null, promise);
84
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/edit", data, null, promise);
75
                 };
85
                 };
76
 
86
 
87
+                luticateAuthUsers.editMe = function(data, promise)
88
+                {
89
+                    return luticateRequest.post("/api/luticate/users/me/edit", data, null, promise);
90
+                };
91
+
77
                 luticateAuthUsers.add = function(data, promise)
92
                 luticateAuthUsers.add = function(data, promise)
78
                 {
93
                 {
79
                     return luticateRequest.post("/api/luticate/users/add", data, null, promise);
94
                     return luticateRequest.post("/api/luticate/users/add", data, null, promise);
84
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/setPassword", data, null, promise);
99
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/setPassword", data, null, promise);
85
                 };
100
                 };
86
 
101
 
102
+                luticateAuthUsers.setPasswordMe = function(data, promise)
103
+                {
104
+                    return luticateRequest.post("/api/luticate/users/me/setPassword", data, null, promise);
105
+                };
106
+
87
                 luticateAuthUsers.del = function(data, promise)
107
                 luticateAuthUsers.del = function(data, promise)
88
                 {
108
                 {
89
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/del", null, null, promise);
109
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/del", null, null, promise);

Loading…
Cancel
Save