You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

luticate-auth.min.js 11KB

1
  1. !function(){angular.module("luticateAuth",[])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthCacheDataAccess",["localStorageService",function(a){var b={};return b.setUser=function(b){a.set("lu_user",b)},b.getUser=function(){return a.get("lu_user")},b.removeUser=function(){a.remove("lu_user")},b.setEffectivePermissions=function(b){a.set("lu_effective_permissions",b)},b.getEffectivePermissions=function(){return a.get("lu_effective_permissions")},b.removeEffectivePermissions=function(){a.remove("lu_effective_permissions")},b.setEffectiveSettings=function(b){a.set("lu_effective_settings",b)},b.getEffectiveSettings=function(){return a.get("lu_effective_settings")},b.removeEffectiveSettings=function(){a.remove("lu_effective_settings")},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthGroupsDataAccess",["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("luticateAuthPermissionsDataAccess",["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(a,c){return a.user_id="me",b.getEffectiveUser(a,c)},b.getAllEffectiveMe=function(a){return b.getAllEffectiveUser({user_id:"me"},a)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissionsGroupDataAccess",["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("luticateAuthPermissionsUserDataAccess",["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("luticateAuthSettingsDataAccess",["luticateRequest",function(a){var b={},c="/api/luticate/settings/";return b.getAll=function(b,d){return a.get(c,b,d)},b.get=function(b,d){return a.get(c+b.setting_name,null,d)},b.edit=function(b,d){return a.post(c+b.setting_name+"/edit",{setting:JSON.stringify(b.setting)},null,d)},b.add=function(b,d){return a.post(c+"add",{setting:JSON.stringify(b)},null,d)},b.del=function(b,d){return a.post(c+b.setting_name+"/del",null,null,d)},b.getEffectiveUser=function(b,d){return a.get(c+"effective/"+b.user_id+"/"+b.setting_name,null,d)},b.getAllEffectiveUser=function(b,d){return a.get(c+"effective/"+b.user_id,null,d)},b.getEffectiveMe=function(b,d){return a.get(c+"effective/me/"+b.setting_name,null,d)},b.getAllEffectiveMe=function(b){return a.get(c+"effective/me",null,b)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthSettingsUserDataAccess",["luticateRequest",function(a){var b={},c="/api/luticate/settings/user/";return b.getAll=function(b,d){return a.get(c+b.user_id,b,d)},b.get=function(b,d){return a.get(c+b.user_id+"/"+b.setting_name,null,d)},b.edit=function(b,d){return a.post(c+b.user_id+"/"+b.setting_name+"/edit",{setting:JSON.stringify(b.setting)},null,d)},b.editMe=function(b,d){return a.post(c+"me/"+b.setting_name+"/edit",{setting_value:JSON.stringify(b.setting_value)},null,d)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthUsersDataAccess",["luticateRequest",function(a){var b={};return b.login=function(b,c){return a.post("/api/luticate/users/login",b,null,c)},b.logout=function(b){return a.post("/api/luticate/users/logout",null,null,b)},b.getAll=function(b,c){return a.get("/api/luticate/users",b,c)},b.get=function(b,c){return a.get("/api/luticate/users/"+b.user_id,null,c)},b.getMe=function(b){return a.get("/api/luticate/users/me",null,b)},b.edit=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/edit",b,null,c)},b.editMe=function(b,c){return a.post("/api/luticate/users/me/edit",b,null,c)},b.add=function(b,c){return a.post("/api/luticate/users/add",b,null,c)},b.setPassword=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/setPassword",b,null,c)},b.setPasswordMe=function(b,c){return a.post("/api/luticate/users/me/setPassword",b,null,c)},b.del=function(b,c){return a.post("/api/luticate/users/"+b.user_id+"/del",null,null,c)},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthCache",["luticateAuthCacheDataAccess",function(a){var b={setUser:a.setUser,getUser:a.getUser,setEffectivePermissions:a.setEffectivePermissions,getEffectivePermissions:a.getEffectivePermissions,removeEffectivePermissions:a.removeEffectivePermissions,setEffectiveSettings:a.setEffectiveSettings,getEffectiveSettings:a.getEffectiveSettings,removeEffectiveSettings:a.removeEffectiveSettings};return b.getToken=function(){var b=a.getUser();return null==b?null:b.Token},b.removeUser=function(){a.removeUser(),a.removeEffectivePermissions(),a.removeEffectiveSettings()},b.hasEffectivePermission=function(b){var c=a.getEffectivePermissions();if(null==c)return null;var d=c[b];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.getEffectiveSetting=function(b){var c=a.getEffectiveSettings();if(null==c)return null;var d=c[b];return null==d?null:d},b.getEffectiveSettingValue=function(a){var c=b.getEffectiveSetting(a);return null==c?null:c.Value},b.setEffectiveSettingValue=function(b,c){var d=a.getEffectiveSettings();null!=d&&(d[b].Value=c,a.setEffectiveSettings(d))},b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthGroups",["luticateAuthGroupsDataAccess",function(a){var b={getAll:a.getAll,get:a.get,edit:a.edit,add:a.add,del:a.del,usersGetAll:a.usersGetAll,usersAdd:a.usersAdd,usersDel:a.usersDel};return b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissions",["luticateAuthPermissionsDataAccess","luticateAuthCache","$q",function(a,b,c){var d={getAll:a.getAll,get:a.get,edit:a.edit,add:a.add,del:a.del,getEffectiveUser:a.getEffectiveUser,getAllEffectiveUser:a.getAllEffectiveUser,getEffectiveMe:a.getEffectiveMe,getAllEffectiveMe:a.getAllEffectiveMe};return d.loadPermissions=function(a){var e=c.defer();return d.getAllEffectiveMe(a).then(function(a){for(var c={},d=0;d<a.Data.length;++d){var f=a.Data[d];c[f.Name]=f.Value}b.setEffectivePermissions(c),e.resolve()},e.reject),e.promise},d}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissionsGroup",["luticateAuthPermissionsGroupDataAccess",function(a){var b={getAll:a.getAll,get:a.get,edit:a.edit,add:a.add,del:a.del};return b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthPermissionsUser",["luticateAuthPermissionsUserDataAccess",function(a){var b={getAll:a.getAll,get:a.get,edit:a.edit,add:a.add,del:a.del};return b}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthSettings",["luticateAuthSettingsDataAccess","luticateAuthCache","$q",function(a,b,c){var d={getAll:a.getAll,get:a.get,edit:a.edit,add:a.add,del:a.del,getEffectiveUser:a.getEffectiveUser,getAllEffectiveUser:a.getAllEffectiveUser,getEffectiveMe:a.getEffectiveMe,getAllEffectiveMe:a.getAllEffectiveMe};return d.loadSettings=function(a){var e=c.defer();return d.getAllEffectiveMe(a).then(function(a){for(var c={},d=0;d<a.Data.length;++d){var f=a.Data[d];c[f.Name]=f}b.setEffectiveSettings(c),e.resolve(a.Data)},e.reject),e.promise},d}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthSettingsUser",["luticateAuthSettingsUserDataAccess","$q","luticateAuthCache",function(a,b,c){var d={getAll:a.getAll,get:a.get,edit:a.edit,editMe:a.editMe};return d.editMe=function(d,e){var f=b.defer();return a.editMe(d,e).then(function(a){c.setEffectiveSettingValue(d.setting_name,d.setting_value),f.resolve(a)},f.reject),f.promise},d}])}(),function(){"use strict";angular.module("luticateAuth").factory("luticateAuthUsers",["luticateAuthUsersDataAccess","$q","luticateAuthCache","luticateAuthPermissions","luticateAuthSettings",function(a,b,c,d,e){var f={getAll:a.getAll,get:a.get,getMe:a.getMe,edit:a.edit,editMe:a.editMe,add:a.add,setPassword:a.setPassword,setPasswordMe:a.setPasswordMe,del:a.del};return f.login=function(d,e){var g=b.defer();return a.login(d,e).then(function(a){c.setUser(a),f.loadUserData(e).then(function(){g.resolve(a)},function(a){f.removeUserData(),g.reject(a)})},function(a){f.removeUserData(),g.reject(a)}),g.promise},f.logout=function(c){var d=b.defer();return a.logout(c)["finally"](function(){f.removeUserData(),f.loadUserData()["finally"](d.resolve)}),d.promise},f.loadUserData=function(a){c.removeEffectivePermissions(),c.removeEffectiveSettings();var g=b.defer();return e.loadSettings(a).then(function(){d.loadPermissions(a).then(g.resolve,function(a){f.removeUserData(),g.reject(a)})},function(a){f.removeUserData(),g.reject(a)}),g.promise},f.loadPermissions=f.loadUserData,f.removeUserData=function(){c.removeEffectivePermissions(),c.removeEffectiveSettings(),c.removeUser()},f}])}();