Sfoglia il codice sorgente

permissions helper; users edit me

tags/0.1.0
Robin Thoni 9 anni fa
parent
commit
7a164dff40
2 ha cambiato i file con 33 aggiunte e 0 eliminazioni
  1. 13
    0
      src/cache.js
  2. 20
    0
      src/users.js

+ 13
- 0
src/cache.js Vedi File

@@ -55,6 +55,19 @@
55 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 71
             luticateAuthCache.removeEffectivePermissions = function()
59 72
             {
60 73
                 localStorageService.remove('lu_effective_permissions');

+ 20
- 0
src/users.js Vedi File

@@ -69,11 +69,26 @@
69 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 82
                 luticateAuthUsers.edit = function(data, promise)
73 83
                 {
74 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 92
                 luticateAuthUsers.add = function(data, promise)
78 93
                 {
79 94
                     return luticateRequest.post("/api/luticate/users/add", data, null, promise);
@@ -84,6 +99,11 @@
84 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 107
                 luticateAuthUsers.del = function(data, promise)
88 108
                 {
89 109
                     return luticateRequest.post("/api/luticate/users/" + data.user_id + "/del", null, null, promise);

Loading…
Annulla
Salva