Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

luticate-auth.min.js 5.9KB

1
  1. !function(){angular.module("luticateAuth",[])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthCache",["localStorageService",function(a){var b={};return b.setUser=function(b){a.set("lu_user",b)},b.getUser=function(){return a.get("lu_user")},b.getToken=function(){var a=b.getUser();return null==a?null:a.Token},b.removeUser=function(){a.remove("lu_user"),b.removeEffectivePermissions()},b.setEffectivePermissions=function(b){a.set("lu_effective_permissions",b)},b.getEffectivePermissions=function(){return a.get("lu_effective_permissions")},b.hasEffectivePermission=function(a){var c=b.getEffectivePermissions();if(null==c)return null;var d=c[a];return null==d?null:d},b.hasAllEffectivePermissions=function(a){return!a.some(function(a){return!b.hasEffectivePermission(a)})},b.hasOneEffectivePermission=function(a){return a.some(b.hasEffectivePermission)},b.removeEffectivePermissions=function(){a.remove("lu_effective_permissions")},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthGroups",["luticateRequest",function(a){var b={};return b.getAll=function(b,c){return a.get("/api/luticate/groups",b,c)},b.get=function(b,c){return a.get("/api/luticate/groups/"+b.group_id,null,c)},b.edit=function(b,c){return a.post("/api/luticate/groups/"+b.group_id+"/edit",b,null,c)},b.add=function(b,c){return a.post("/api/luticate/groups/add",b,null,c)},b.del=function(b,c){return a.post("/api/luticate/groups/"+b.group_id+"/del",null,null,c)},b.usersGetAll=function(b,c){return a.get("/api/luticate/groups/"+b.group_id+"/users",b,c)},b.usersAdd=function(b,c){return a.post("/api/luticate/groups/"+b.group_id+"/users/"+b.user_id+"/add",b,null,c)},b.usersDel=function(b,c){return a.post("/api/luticate/groups/"+b.group_id+"/users/"+b.user_id+"/del",b,null,c)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissions",["luticateRequest",function(a){var b={};return b.getAll=function(b,c){return a.get("/api/luticate/permissions",b,c)},b.get=function(b,c){return a.get("/api/luticate/permissions/"+b.permission_name,null,c)},b.edit=function(b,c){return a.post("/api/luticate/permissions/"+b.permission_name+"/edit/"+b.permission_value,null,null,c)},b.add=function(b,c){return a.post("/api/luticate/permissions/add/"+b.permission_name+"/"+b.permission_value,null,null,c)},b.del=function(b,c){return a.post("/api/luticate/permissions/"+b.permission_name+"/del",null,null,c)},b.getEffectiveUser=function(b,c){return a.get("/api/luticate/permissions/effective/"+b.user_id+"/"+b.permission_name,null,c)},b.getAllEffectiveUser=function(b,c){return a.get("/api/luticate/permissions/effective/"+b.user_id,null,c)},b.getEffectiveMe=function(b,c){return a.get("/api/luticate/permissions/effective/me/"+b.permission_name,null,c)},b.getAllEffectiveMe=function(b){return a.get("/api/luticate/permissions/effective/me",null,b)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissionsGroup",["luticateRequest",function(a){var b={};return b.getAll=function(b,c){return a.get("/api/luticate/permissions/group/"+b.group_id,b,c)},b.get=function(b,c){return a.get("/api/luticate/permissions/group/"+b.group_id+"/"+b.permission_name,null,c)},b.edit=function(b,c){return a.post("/api/luticate/permissions/group/"+b.group_id+"/"+b.permission_name+"/edit/"+b.permission_value,null,null,c)},b.add=function(b,c){return a.post("/api/luticate/permissions/group/"+b.group_id+"/add/"+b.permission_name+"/"+b.permission_value,null,null,c)},b.del=function(b,c){return a.post("/api/luticate/permissions/group/"+b.group_id+"/"+b.permission_name+"/del",null,null,c)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissionsUser",["luticateRequest",function(a){var b={};return b.getAll=function(b,c){return a.get("/api/luticate/permissions/user/"+b.user_id,b,c)},b.get=function(b,c){return a.get("/api/luticate/permissions/user/"+b.user_id+"/"+b.permission_name,null,c)},b.edit=function(b,c){return a.post("/api/luticate/permissions/user/"+b.user_id+"/"+b.permission_name+"/edit/"+b.permission_value,null,null,c)},b.add=function(b,c){return a.post("/api/luticate/permissions/user/"+b.user_id+"/add/"+b.permission_name+"/"+b.permission_value,null,null,c)},b.del=function(b,c){return a.post("/api/luticate/permissions/user/"+b.user_id+"/"+b.permission_name+"/del",null,null,c)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthUsers",["luticateRequest","$q","luticateAuthCache","luticateAuthPermissions",function(a,b,c,d){var e={};return e.login=function(d,f){var g=b.defer();return a.post("/api/luticate/users/login",d,null,f).then(function(a){c.setUser(a),e.loadPermissions(f).then(function(b){g.resolve(a)},function(a){c.removeUser(),g.reject(a)})},function(a){c.removeUser(),g.reject(a)}),g.promise},e.loadPermissions=function(a){var e=b.defer();return d.getAllEffectiveMe(a).then(function(a){for(var b={},d=0;d<a.Data.length;++d){var f=a.Data[d];b[f.Name]=f.Value}c.setEffectivePermissions(b),e.resolve(a.Data)},e.reject),e.promise},e.logout=function(d){var f=b.defer();return a.post("/api/luticate/users/logout",null,null,d)["finally"](function(){c.removeUser(),e.loadPermissions(d)["finally"](f.resolve)}),f.promise},e.getAll=function(b,c){return a.get("/api/luticate/users",b,c)},e.get=function(b,c){return a.get("/api/luticate/users/"+b.user_id,null,c)},e.getMe=function(b){return a.get("/api/luticate/users/me",null,b)},e.edit=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/edit",b,null,c)},e.editMe=function(b,c){return a.post("/api/luticate/users/me/edit",b,null,c)},e.add=function(b,c){return a.post("/api/luticate/users/add",b,null,c)},e.setPassword=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/setPassword",b,null,c)},e.setPasswordMe=function(b,c){return a.post("/api/luticate/users/me/setPassword",b,null,c)},e.del=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/del",null,null,c)},e}])}();