diff options
author | 2017-04-22 13:25:07 +0200 | |
---|---|---|
committer | 2017-04-22 13:25:07 +0200 | |
commit | d182202fc6001983541504ed323d68479086317e (patch) | |
tree | 11d4c10cdd3e995f519c3e0e324968fdaf175114 /moonv4/moon_gui/delivery/js/app.js | |
parent | 83c1c966baf73329fab8ddcfad19ad7fe0c41c2a (diff) |
add moonv4
Change-Id: I247af788d0b0fb961fbc85416486b241eb1d807c
Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonv4/moon_gui/delivery/js/app.js')
-rw-r--r-- | moonv4/moon_gui/delivery/js/app.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/moonv4/moon_gui/delivery/js/app.js b/moonv4/moon_gui/delivery/js/app.js new file mode 100644 index 00000000..9f1f639e --- /dev/null +++ b/moonv4/moon_gui/delivery/js/app.js @@ -0,0 +1,3 @@ +!function(){"use strict";function e(e,s,u,d){s.useStaticFilesLoader({prefix:"assets/i18n/",suffix:".json"}).preferredLanguage("en").useCookieStorage(),d.theme="selectize",e.when("","/project"),e.when("/","/project"),e.otherwise("/404"),t(u),o(u),n(u),a(u),r(u),i(u),c(u),l(u)}function t(e){return e.state("moon",{abstract:!0,template:"<div ui-view></div>"}).state("moon.404",{url:"/404",templateUrl:"html/common/404/404.tpl.html"}),e}function o(e){return e.state("moon.dashboard",{url:"/dashboard",templateUrl:"html/dashboard/dashboard.tpl.html"}),e}function n(e){return e.state("moon.auth",{abstract:!0,template:"<div ui-view></div>"}).state("moon.auth.login",{url:"/login",templateUrl:"html/authentication/authentication.tpl.html",controller:"AuthenticationController",controllerAs:"auth"}),e}function r(e){return e.state("moon.model",{abstract:!0,template:"<div ui-view></div>"}).state("moon.model.list",{url:"/model",templateUrl:"html/model/model-list.tpl.html",controller:"ModelListController",controllerAs:"list",resolve:{models:["modelService",function(e){return e.findAll()}]}}).state("moon.model.edit",{url:"/model/:id",templateUrl:"html/model/edit/model-edit.tpl.html",controller:"ModelEditController",controllerAs:"edit",resolve:{model:["$stateParams","modelService",function(e,t){return t.findOneWithMetaRules(e.id)}]}}),e}function a(e){return e.state("moon.project",{abstract:!0,template:"<div ui-view></div>"}).state("moon.project.list",{url:"/project",templateUrl:"html/project/project-list.tpl.html",controller:"ProjectListController",controllerAs:"list",resolve:{projects:["projectService",function(e){return e.findAll()}]}}),e}function i(e){return e.state("moon.pdp",{abstract:!0,template:"<div ui-view></div>"}).state("moon.pdp.list",{url:"/pdp",templateUrl:"html/pdp/pdp-list.tpl.html",controller:"PDPListController",controllerAs:"list",resolve:{pdps:["pdpService",function(e){return e.findAll()}]}}).state("moon.pdp.edit",{url:"/pdp/:id",templateUrl:"html/pdp/edit/pdp-edit.tpl.html",controller:"PDPEditController",controllerAs:"edit",resolve:{pdp:["$stateParams","pdpService",function(e,t){return t.findOne(e.id)}]}}),e}function c(e){return e.state("moon.policy",{abstract:!0,template:"<div ui-view></div>"}).state("moon.policy.list",{url:"/policy",templateUrl:"html/policy/policy-list.tpl.html",controller:"PolicyListController",controllerAs:"list",resolve:{policies:["policyService",function(e){return e.findAll()}]}}).state("moon.policy.edit",{url:"/policy/:id",templateUrl:"html/policy/edit/policy-edit.tpl.html",controller:"PolicyEditController",controllerAs:"edit",resolve:{policy:["$stateParams","policyService",function(e,t){return t.findOne(e.id)}]}}),e}function l(e){return e.state("moon.logs",{url:"/logs",templateUrl:"html/logs/logs.tpl.html",controller:"LogsController",controllerAs:"logs"}),e}function s(e,t,o,n,r,a,i){function c(e,t,o){["/login"].indexOf(i.path())===-1&&!a.currentUser&&i.path("/login")}function l(){e.connected=r.IsConnected(),e.transitionModal.$promise.then(e.transitionModal.show)}function s(){e.transitionModal.hide()}function u(t,r,a,i,c,l){var s=d(t,r,a,i,c,l);o("moon.global.error",{stacktrace:s}).then(function(e){n.alertError(e)}),e.transitionModal.hide()}function d(e,t,o,n,r,a){var i={};return i.status=a.status,i.message=a.statusText,i.state=t,i.params=o,i}e.connected=r.IsConnected(),e.transitionModal=t({scope:e,template:"html/common/waiting/waiting.tpl.html",backdrop:"static",show:!1}),e.$on("$stateChangeStart",l),e.$on("$stateChangeSuccess",s),e.$on("$stateChangeError",u),e.$on("$locationChangeStart",c),r.IsConnected()&&r.SetTokenHeader(r.GetTokenHeader())}angular.module("moon",["ngResource","ngRoute","ui.router","ngMessages","ui.bootstrap","ngTable","ngCookies","ngStorage","pascalprecht.translate","ngAnimate","mgcrea.ngStrap","NgSwitchery","ui.select","toaster"]).config(e).run(s);e.$inject=["$urlRouterProvider","$translateProvider","$stateProvider","uiSelectConfig"],s.$inject=["$rootScope","$modal","$translate","alertService","authenticationService","$sessionStorage","$location"]}(),function(){"use strict";angular.module("moon").constant("DEFAULT_CST",{DOMAIN:{DEFAULT:"Default"}}).constant("SECURITY_PIPELINE_CST",{TYPE:{POLICY:"policy"}}).constant("META_DATA_CST",{TYPE:{SUBJECT:"SUBJECT",OBJECT:"OBJECT",ACTION:"ACTION"}}).constant("PERIMETER_CST",{TYPE:{SUBJECT:"SUBJECT",OBJECT:"OBJECT",ACTION:"ACTION"}}).constant("DATA_CST",{TYPE:{SUBJECT:"SUBJECT",OBJECT:"OBJECT",ACTION:"ACTION"}}).constant("ASSIGNMENTS_CST",{TYPE:{SUBJECT:"SUBJECT",OBJECT:"OBJECT",ACTION:"ACTION"}}).constant("RULES_CST",{TYPE:{SUBJECT:"SUBJECT",OBJECT:"OBJECT",ACTION:"ACTION"}}).constant("REST_URI",{PDP:"http://172.18.0.11:38001/pdp/",MODELS:"http://172.18.0.11:38001/models/",METARULES:"http://172.18.0.11:38001/meta_rules/",RULES:"http://172.18.0.11:38001/rules/",POLICIES:"http://172.18.0.11:38001/policies/",METADATA:{subject:"http://172.18.0.11:38001/subject_categories/",object:"http://172.18.0.11:38001/object_categories/",action:"http://172.18.0.11:38001/action_categories/"},PERIMETERS:{subject:"http://172.18.0.11:38001/subjects/",object:"http://172.18.0.11:38001/objects/",action:"http://172.18.0.11:38001/actions/"},KEYSTONE:"http://keystone:5000/v3/"})}(),function(){"use strict";function e(e,t,o,n,r){function a(){l.loading=!0,e.Login(l.credentials,i,c)}function i(){t("moon.login.success").then(function(e){o.alertSuccess(e),n.go("moon.dashboard"),l.loading=!1})}function c(e){t("moon.login.error",{errorCode:e.status}).then(function(e){o.alertError(e),l.loading=!1})}var l=this;l.login=a,l.loading=!1,l.credentials={username:"",password:""},function(){r.connected&&n.go("moon.dashboard")}()}angular.module("moon").controller("AuthenticationController",e),e.$inject=["authenticationService","$translate","alertService","$state","$rootScope"]}(),function(){"use strict";function e(){}angular.module("moon").controller("LogsController",e)}(),function(){"use strict";function e(e,t,o,n,r,a){function i(){return S.table=new n({page:1,count:10,sorting:{name:"asc"}},{total:function(){return S.getModels().length},getData:function(e,t){var o=t.sorting()?r("orderBy")(S.getModels(),t.orderBy()):S.getModels();e.resolve(o.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),S.table}function c(){return S.models?S.models:[]}function l(){return S.getModels().length>0}function s(){S.search.query=""}function u(e){return e.name.indexOf(S.search.query)!==-1||e.description.indexOf(S.search.query)!==-1}function d(){S.add.modal.$promise.then(S.add.modal.show)}function m(e){S.models.push(e)}function p(){S.table.total(S.models.length),S.table.reload()}function f(e,t){m(t),p(),S.add.modal.hide()}function h(e){S.add.modal.hide()}function g(e){S.view.modal.$scope.model=e,S.view.modal.$promise.then(S.view.modal.show)}function v(e){S.del.modal.$scope.model=e,S.del.modal.$promise.then(S.del.modal.show)}function y(e){S.models=_.chain(S.models).reject({id:e.id}).value()}function j(e,t){S.deleteModel(t),S.refreshModels(),S.del.modal.hide()}function b(e,t){S.del.modal.hide()}var S=this;S.models=o,S.table={},S.search={query:"",find:u,reset:s},S.getModels=c,S.hasModels=l,S.deleteModel=y,S.refreshModels=p,S.add={modal:a({template:"html/model/action/model-add.tpl.html",show:!1}),showModal:d},S.view={modal:a({template:"html/model/action/model-view.tpl.html",show:!1}),showModal:g},S.del={modal:a({template:"html/model/action/model-delete.tpl.html",show:!1}),showModal:v},function(){i()}();var $={"event:modelCreatedSuccess":t.$on("event:modelCreatedSuccess",f),"event:modelCreatedError":t.$on("event:modelCreatedError",h),"event:modelDeletedSuccess":t.$on("event:modelDeletedSuccess",j),"event:modelDeletedError":t.$on("event:modelDeletedError",b)};for(var E in $)e.$on("$destroy",$[E])}angular.module("moon").controller("ModelListController",e),e.$inject=["$scope","$rootScope","models","NgTableParams","$filter","$modal"]}(),function(){"use strict";function e(e,t,o,n,r,a,i){function c(){return M.pdps?M.pdps:[]}function l(){return M.getPDPs().length>0}function s(e){M.pdps.push(e)}function u(e){M.pdps=_.chain(M.pdps).reject({id:e.id}).value()}function d(){M.table.total(M.pdps.length),M.table.reload()}function m(e){return _(_.values(M.getPDPs())).each(function(t){t.id===e.id&&(t=_.clone(e))}),M.pdps}function p(e){return e.id}function f(e){return e.tenant.name}function h(e){return e?e.name:""}function g(e){return!_.isNull(e.keystone_project_id)}function v(e){return _.has(e,"project")?e.project:(_.has(e,"callPdpInProgress")||(e.callPdpInProgress=!0,i.findOne(e.keystone_project_id,function(t){return e.callPdpInProgress=!1,e.project=t,e.project})),!1)}function y(){return M.table=new r({page:1,count:10,sorting:{name:"asc"}},{total:function(){return M.getPDPs().length},getData:function(e,t){var n=t.sorting()?o("orderBy")(M.getPDPs(),t.orderBy()):M.getPDPs();e.resolve(n.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),M.table}function j(e){return M.getPDPName(e).indexOf(M.search.query)!==-1||M.getSecPipelineFromPdp(e).indexOf(M.search.query)!==-1}function b(e){return e.security_pipeline?e.security_pipeline:[]}function S(){M.search.query=""}function $(){M.add.modal.$promise.then(M.add.modal.show)}function E(e,t){M.addPDP(t),M.refreshPDPs(),M.add.modal.hide()}function P(e,t){M.add.modal.hide()}function T(e){M.del.modal.$scope.pdp=e,M.del.modal.$promise.then(M.del.modal.show)}function C(e,t){M.deletePDP(t),M.refreshPDPs(),M.del.modal.hide()}function O(){M.del.modal.hide()}var M=this;M.pdps=a,M.mappings=[],M.getPDPs=c,M.hasPDPs=l,M.getPDPName=h,M.isMapped=g,M.getProjectFromPDP=v,M.getidFromPDP=p,M.table={},M.addPDP=s,M.deletePDP=u,M.refreshPDPs=d,M.updatePDPs=m,M.getMappedProjectName=f,M.getSecPipelineFromPdp=b,M.search={query:"",find:j,reset:S},M.add={modal:n({template:"html/pdp/action/pdp-add.tpl.html",show:!1}),showModal:$},M.del={modal:n({template:"html/pdp/action/pdp-delete.tpl.html",show:!1}),showModal:T},function(){y()}();var A={"event:pdpCreatedSuccess":e.$on("event:pdpCreatedSuccess",E),"event:pdpCreatedError":e.$on("event:pdpCreatedError",P),"event:pdpDeletedSuccess":e.$on("event:pdpDeletedSuccess",C),"event:pdpDeletedError":e.$on("event:pdpDeletedError",O)};for(var R in A)t.$on("$destroy",A[R])}angular.module("moon").controller("PDPListController",e),e.$inject=["$rootScope","$scope","$filter","$modal","ngTableParams","pdps","projectService"]}(),function(){"use strict";function e(e,t,o,n,r,a){function i(){return b.policies?b.policies:[]}function c(){return b.getPolicies().length>0}function l(){return b.table=new o({page:1,count:10,sorting:{name:"asc",genre:"asc"}},{total:function(){return b.getPolicies().length},getData:function(e,t){var o=t.sorting()?n("orderBy")(b.getPolicies(),t.orderBy()):b.getPolicies();e.resolve(o.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),b.table}function s(e){return e.name.indexOf(b.search.query)!==-1||e.genre.indexOf(b.search.query)!==-1||e.description.indexOf(b.search.query)!==-1}function u(){b.search.query=""}function d(){b.add.modal.$promise.then(b.add.modal.show)}function m(e,t){b.addPolicy(t),b.refreshPolicies(),b.add.modal.hide()}function p(e,t){b.add.modal.hide()}function f(e){b.policies.push(e)}function h(){b.table.total(b.policies.length),b.table.reload()}function g(e){b.del.modal.$scope.policy=e,b.del.modal.$promise.then(b.del.modal.show)}function v(e){b.policies=_.chain(b.policies).reject({id:e.id}).value()}function y(e,t){b.deletePolicy(t),b.refreshPolicies(),b.del.modal.hide()}function j(e,t){b.del.modal.hide()}var b=this;b.policies=t,b.getPolicies=i,b.hasPolicies=c,b.addPolicy=f,b.refreshPolicies=h,b.deletePolicy=v,b.table={},b.search={query:"",find:s,reset:u},b.add={modal:r({template:"html/policy/action/policy-add.tpl.html",show:!1}),showModal:d},b.del={modal:r({template:"html/policy/action/policy-delete.tpl.html",show:!1}),showModal:g},function(){l()}();var S={"event:policyCreatedSuccess":a.$on("event:policyCreatedSuccess",m),"event:policyCreatedError":a.$on("event:policyCreatedError",p),"event:policyDeletedSuccess":a.$on("event:policyDeletedSuccess",y),"event:policyDeletedError":a.$on("event:policyDeletedError",j)};for(var $ in S)e.$on("$destroy",S[$])}angular.module("moon").controller("PolicyListController",e),e.$inject=["$scope","policies","ngTableParams","$filter","$modal","$rootScope"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/policy-mapped-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{pdp:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(e){v.policiesId=v.pdp.security_pipeline,a.findSomeWithCallback(v.policiesId,function(t){v.policies=t,v.loadingPolicies=!1,e?u():c()})}function c(){return v.table=new o({page:1,count:10,sorting:{name:"asc"}},{total:function(){return v.getPolicies().length},getData:function(e,t){var o=t.sorting()?r("orderBy")(v.getPolicies(),t.orderBy()):v.getPolicies();e.resolve(o.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),v.table}function l(){return v.policies?v.policies:[]}function s(){return v.getPolicies().length>0}function u(){v.table.total(v.getPolicies().length),v.table.reload()}function d(){v.map.modal.$scope.pdp=v.pdp,v.map.modal.$promise.then(v.map.modal.show)}function m(e){v.unmap.modal.$scope.pdp=v.pdp,v.unmap.modal.$scope.policy=e,v.unmap.modal.$promise.then(v.unmap.modal.show)}function p(e,t){v.pdp=t,i(!0),v.map.modal.hide()}function f(e){v.map.modal.hide()}function h(e,t){v.pdp=t,i(!0),v.unmap.modal.hide()}function g(e){v.unmap.modal.hide()}var v=this;v.table={},v.pdp=e.list.pdp,v.getPolicies=l,v.hasPolicies=s,v.refreshPolicies=u,v.loadingPolicies=!0,v.policies=[],function(){i(!1)}(),v.map={modal:n({template:"html/policy/action/mapping/policy-map.tpl.html",show:!1}),showModal:d},v.unmap={modal:n({template:"html/policy/action/mapping/policy-unmap.tpl.html",show:!1}),showModal:m};var y={"event:policyMapToPdpSuccess":t.$on("event:policyMapToPdpSuccess",p),"event:policyMapToPdpError":t.$on("event:policyMapToPdpError",f),"event:policyUnMappedToPdpSuccess":t.$on("event:policyUnMappedToPdpSuccess",h),"event:policyUnMappedToPdpError":t.$on("event:policyUnMappedToPdpError",g)};for(var j in y)e.$on("$destroy",y[j])}angular.module("moon").directive("moonPolicyMappedList",e),e.$inject=[],angular.module("moon").controller("moonPolicyMappedListController",t),t.$inject=["$scope","$rootScope","NgTableParams","$modal","$filter","policyService"]}(),function(){"use strict";function e(e,t,o,n,r,a,i){function c(){N.loadingPDPs=!0,h(),a.findAllWithCallBack(function(e){N.pdps=e,a.mapPdpsToProjects(N.projects,N.pdps),N.loadingPDPs=!1})}function l(){return N.projects?N.projects:[]}function s(){return N.getProjects().length>0}function u(e){return _.has(e,"pdp")}function d(e){return e.pdp}function m(e){N.projects.push(e)}function p(e){N.projects=_.chain(N.projects).reject({id:e.id}).value()}function f(){N.table.total(N.projects.length),N.table.reload()}function h(){return N.table=new r({page:1,count:10,sorting:{name:"asc"}},{total:function(){return N.getProjects().length},getData:function(e,t){var n=t.sorting()?o("orderBy")(N.getProjects(),t.orderBy()):N.getProjects();e.resolve(n.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),N.table}function g(e){return _.has(e,"pdp")?e.pdp.name:"error"}function v(e){return e.name.indexOf(N.search.query)!==-1||e.description.indexOf(N.search.query)!==-1}function y(){N.search.query=""}function j(){N.add.modal.$promise.then(N.add.modal.show)}function b(e,t){N.addProject(t),N.refreshProjects(),N.add.modal.hide()}function S(e,t){N.add.modal.hide()}function $(e){N.del.modal.$scope.project=e,N.del.modal.$promise.then(N.del.modal.show)}function E(e,t){N.deleteProject(t),N.refreshProjects(),N.del.modal.hide()}function P(e,t){N.del.modal.hide()}function T(e){N.map.modal.$scope.project=e,N.map.modal.$promise.then(N.map.modal.show)}function C(e,t){c(),N.map.modal.hide()}function O(e,t){N.map.modal.hide()}function M(e){N.unmap.modal.$scope.project=e,N.unmap.modal.$promise.then(N.unmap.modal.show)}function A(e,t){var o=_.findIndex(N.projects,function(e){return t.id===e.id});if(o===-1)return N.unmap.modal.hide(),!1;N.projects[o]=t,N.refreshProjects(),N.unmap.modal.hide()}function R(e,t){N.unmap.modal.hide()}function D(e){N.view.modal.$scope.project=e,N.view.modal.$promise.then(N.view.modal.show)}var N=this;N.projects=i,N.pdps=[],N.getProjects=l,N.hasProjects=s,N.isProjectMapped=u,N.table={},N.addProject=m,N.deleteProject=p,N.refreshProjects=f,N.getMappedPDPName=g,N.getPdpFromProject=d,N.search={query:"",find:v,reset:y},N.add={modal:n({template:"html/project/action/project-add.tpl.html",show:!1}),showModal:j},N.del={modal:n({template:"html/project/action/project-delete.tpl.html",show:!1}),showModal:$},N.map={modal:n({template:"html/project/action/mapping/project-map.tpl.html",show:!1}),showModal:T},N.unmap={modal:n({template:"html/project/action/mapping/project-unmap.tpl.html",show:!1}),showModal:M},N.view={modal:n({template:"html/project/action/project-view.tpl.html",show:!1}),showModal:D},c();var w={"event:projectCreatedSuccess":e.$on("event:projectCreatedSuccess",b),"event:projectCreatedError":e.$on("event:projectCreatedError",S),"event:projectDeletedSuccess":e.$on("event:projectDeletedSuccess",E),"event:projectDeletedError":e.$on("event:projectDeletedError",P),"event:projectMappedSuccess":e.$on("event:projectMappedSuccess",C),"event:projectMappedError":e.$on("event:projectMappedError",O),"event:projectUnmappedSuccess":e.$on("event:projectUnmappedSuccess",A),"event:projectUnmappedError":e.$on("event:projectUnmappedError",R)};for(var I in w)t.$on("$destroy",w[I])}angular.module("moon").controller("ProjectListController",e),e.$inject=["$rootScope","$scope","$filter","$modal","ngTableParams","pdpService","projects"]}(),function(){"use strict";function e(e,t){function o(){n.browsersModal.$promise.then(n.browsersModal.show)}var n=this;n.version=null,n.browsersModal=null,n.showBrowsersCompliance=o,function(){n.browsersModal=e({template:"html/common/compatibility/compatibility.tpl.html",show:!1}),n.browsersModal}(),function(){var e=n;t.version.get().$promise.then(function(t){return e.version=t.version?t.version:"SNAPSHOT",e.version})}()}angular.module("moon").controller("FooterController",e),e.$inject=["$modal","versionService"]}(),function(){"use strict";function e(e,t,o,n){function r(t,o){o.preventDefault(),e.use(t),e.preferredLanguage(t)}function a(){o.Logout(),e("moon.logout.success").then(function(e){n.alertSuccess(e)})}var i=this;i.isProjectTabActive=t.isProjectTabActive,i.isPDPTabActive=t.isPDPTabActive,i.isLogsTabActive=t.isLogsTabActive,i.isPolicyTabActive=t.isPolicyTabActive,i.isModelTabActive=t.isModelTabActive,i.changeLocale=r,i.logout=a,i.getUser=o.GetUser}angular.module("moon").controller("HeaderController",e),e.$inject=["$translate","menuService","authenticationService","alertService"]}(),function(){"use strict";function e(){return{templateUrl:"html/common/loader/loader.tpl.html",restrict:"E"}}angular.module("moon").directive("moonLoader",e),e.$inject=[]}(),function(){"use strict";function e(e,t,o,n,r,a){function i(){function i(t){var r=a.transformOne(t,"models");n("moon.model.add.success",{modelName:r.name}).then(function(e){o.alertSuccess(e)}),c.loading=!1,e.$emit("event:modelCreatedSuccess",r)}function l(t){n("moon.model.add.error",{modelName:c.model.name}).then(function(e){o.alertError(e)}),c.loading=!1,e.$emit("event:modelCreatedError",c.project)}r.isInvalid(c.form)?r.checkFieldsValidity(c.form):(c.loading=!0,t.data.create({},c.model,i,l))}var c=this;c.form={},c.loading=!1,c.model={name:null,description:null,meta_rules:[]},c.create=i}angular.module("moon").controller("ModelAddController",e),e.$inject=["$scope","modelService","alertService","$translate","formService","utilService"]}(),function(){"use strict";function e(e,t,o,n){function r(){function r(n){t("moon.model.remove.success",{modelName:a.model.name}).then(function(e){o.alertSuccess(e)}),a.loading=!1,e.$emit("event:modelDeletedSuccess",a.model)}function i(n){t("moon.model.remove.error",{modelName:a.model.name,errorCode:n.data.error.code,message:n.data.error.message}).then(function(e){o.alertError(e)}),a.loading=!1,e.$emit("event:modelDeletedError",a.model)}a.loading=!0,n.delete(a.model,r,i)}var a=this;a.model=e.model,a.loading=!1,a.remove=r}angular.module("moon").controller("ModelDeleteController",e),e.$inject=["$scope","$translate","alertService","modelService"]}(),function(){"use strict";function e(e,t){function o(){t.findSomeWithMetaData(n.model.meta_rules).then(function(e){n.meta_rules_values=e,n.model.meta_rules_values=e})}var n=this;n.model=e.model,n.meta_rules_values=!1,function(){n.model.meta_rules.length>0?o():n.meta_rules_values=[]}()}angular.module("moon").controller("ModelViewController",e),e.$inject=["$scope","metaRuleService"]}(),function(){"use strict";function e(e,t,o,n){function r(e,t){a.model=t}var a=this;a.model=o,a.editBasic=!1,a.editMetaRules=!0;var i={"event:modelUpdatedSuccess":t.$on("event:modelUpdatedSuccess",r),"event:updateModelFromMetaRuleAddSuccess":t.$on("event:updateModelFromMetaRuleAddSuccess",r)};for(var c in i)e.$on("$destroy",i[c])}angular.module("moon").controller("ModelEditController",e),e.$inject=["$scope","$rootScope","model","$stateParams"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/model-edit-basic.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{model:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(){function i(t){var o=a.transformOne(t,"models");r("moon.model.edit.basic.success",{modelName:o.name}).then(function(e){n.alertSuccess(e)}),l.loading=!1,e.$emit("event:modelUpdatedSuccess",o)}function c(e){r("moon.model.edit.basic.error",{modelName:l.model.name}).then(function(e){n.alertError(e)}),l.loading=!1}o.isInvalid(l.form)?o.checkFieldsValidity(l.form):(l.loading=!0,t.update(l.modelToEdit,i,c))}function c(){l.modelToEdit=angular.copy(l.model)}var l=this;l.editModel=i,l.init=c,l.form={},function(){l.model=e.edit.model,l.modelToEdit=angular.copy(l.model)}()}angular.module("moon").directive("moonModelEditBasic",e),e.$inject=[],angular.module("moon").controller("moonModelEditBasicController",t),t.$inject=["$scope","modelService","formService","alertService","$translate","utilService"]}(),function(){"use strict";function e(e,t,o,n,r,a,i){function c(a){function c(n){t("moon.pdp.add.success",{pdpName:a.name}).then(function(e){o.alertSuccess(e)});var r=i.transformOne(n,"pdps");l.loading=!1,e.$emit("event:pdpCreatedSuccess",r)}function s(n){t("moon.pdp.add.error",{pdpName:a.name}).then(function(e){o.alertError(e)}),l.loading=!1,e.$emit("event:pdpCreatedError")}n.isInvalid(l.form)?n.checkFieldsValidity(l.form):(l.loading=!0,r.data.pdp.create({},{name:l.pdp.name,description:l.pdp.description,security_pipeline:[l.selectedPolicy.id],keystone_project_id:null},c,s))}var l=this;l.form={},l.pdp={},l.policies=[],l.selectedPolicy=null,l.loading=!1,l.loadingPolicies=!0,l.create=c,function(){a.findAllWithCallback(function(e){l.policies=e,l.loadingPolicies=!1})}()}angular.module("moon").controller("PDPAddController",e),e.$inject=["$scope","$translate","alertService","formService","pdpService","policyService","utilService"]}(),function(){"use strict";function e(e,t,o,n){function r(){function r(n){t("moon.pdp.remove.success",{pdpName:a.pdp.name}).then(function(e){o.alertSuccess(e)}),a.loading=!1,e.$emit("event:pdpDeletedSuccess",a.pdp)}function i(n){t("moon.pdp.remove.error",{pdpName:a.pdp.name}).then(function(e){o.alertError(e)}),a.loading=!1,e.$emit("event:pdpDeletedError",a.pdp)}a.loading=!0,n.data.pdp.remove({pdp_id:a.pdp.id},r,i)}var a=this;a.pdp=e.pdp,a.loading=!1,a.remove=r}angular.module("moon").controller("PDPDeleteController",e),e.$inject=["$scope","$translate","alertService","pdpService"]}(),function(){"use strict";function e(e,t,o,n){function r(e,t){a.pdp=t}var a=this;a.pdp=o,a.editBasic=!1;var i={"event:pdpUpdatedSuccess":t.$on("event:pdpUpdatedSuccess",r)};for(var c in i)e.$on("$destroy",i[c])}angular.module("moon").controller("PDPEditController",e),e.$inject=["$scope","$rootScope","pdp","$stateParams"]}(),function(){"use strict";function e(){return{templateUrl:"html/pdp/edit/pdp-edit-basic.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{pdp:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(){function i(t){var o=a.transformOne(t,"pdps");r("moon.pdp.edit.basic.success",{pdpName:o.name}).then(function(e){n.alertSuccess(e)}),l.loading=!1,e.$emit("event:pdpUpdatedSuccess",o)}function c(e){r("moon.pdp.edit.basic.error",{pdpName:l.pdp.name}).then(function(e){n.alertError(e)}),l.loading=!1}o.isInvalid(l.form)?o.checkFieldsValidity(l.form):(l.loading=!0,t.update(l.pdpToEdit,i,c))}function c(){l.pdpToEdit=angular.copy(l.pdp)}var l=this;l.editPdp=i,l.init=c,l.form={},function(){l.pdp=e.edit.pdp,l.pdpToEdit=angular.copy(l.pdp)}()}angular.module("moon").directive("moonPDPEditBasic",e),e.$inject=[],angular.module("moon").controller("moonPDPEditBasicController",t),t.$inject=["$scope","pdpService","formService","alertService","$translate","utilService"]}(),function(){"use strict";function e(e,t,o,n,r,a,i){function c(){i.findAllWithCallBack(l)}function l(e){u.models=e,u.modelsLoading=!1}function s(){function i(n){var r=a.transformOne(n,"policies");t("moon.policy.add.success",{policyName:r.name}).then(function(e){o.alertSuccess(e)}),u.loading=!1,e.$emit("event:policyCreatedSuccess",r)}function c(n){t("moon.policy.add.error",{policyName:u.model.name}).then(function(e){o.alertError(e)}),u.loading=!1,e.$emit("event:policyCreatedError",u.project)}n.isInvalid(u.form)?n.checkFieldsValidity(u.form):(u.loading=!0,r.data.policy.create({},{name:u.policy.name,description:u.policy.description,genre:[u.selectedGenre],model_id:u.selectedModel.id},i,c))}var u=this;u.loading=!1,u.form={},u.policy={name:null,genre:null,description:null,model_id:null},u.genres=["admin","authz"],u.models=[],u.modelsLoading=!0,u.create=s,function(){c()}()}angular.module("moon").controller("PolicyAddController",e),e.$inject=["$scope","$translate","alertService","formService","policyService","utilService","modelService"]}(),function(){"use strict";function e(e,t,o,n){function r(){function r(n){t("moon.policy.remove.success",{policyName:a.policy.name}).then(function(e){o.alertSuccess(e)}),a.loading=!1,e.$emit("event:policyDeletedSuccess",a.policy)}function i(n){t("moon.policy.remove.error",{policyName:a.policy.name,errorCode:n.data.error.code,message:n.data.error.message}).then(function(e){o.alertError(e)}),a.loading=!1,e.$emit("event:policyDeletedError",a.policy)}a.loading=!0,n.delete(a.policy,r,i)}var a=this;a.policy=e.policy,a.loading=!1,a.remove=r}angular.module("moon").controller("PolicyDeleteController",e),e.$inject=["$scope","$translate","alertService","policyService"]}(),function(){"use strict";function e(e,t,o,n){function r(){i.loadingModel=!0,n.findOneWithCallback(i.policy.model_id,function(e){i.loadingModel=!1,i.policy.model=e})}function a(e,t){i.policy=t,r()}var i=this;i.policy=o,i.editBasic=!1,i.showPerimeters=!1,i.showData=!1,i.showRules=!1,i.showAssignments=!1,function(){r()}();var c={"event:policyUpdatedSuccess":t.$on("event:policyUpdatedSuccess",a)};for(var l in c)e.$on("$destroy",c[l])}angular.module("moon").controller("PolicyEditController",e),e.$inject=["$scope","$rootScope","policy","modelService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/policy-edit-basic.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{policy:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i){function c(){i.findAllWithCallBack(l)}function l(e){d.models=e,_.each(e,function(e){e.id===d.policy.model_id&&(d.selectedModel=e)}),d.modelsLoading=!1}function s(){function i(t){var o=a.transformOne(t,"policies");r("moon.policy.edit.basic.success",{policyName:o.name}).then(function(e){n.alertSuccess(e)}),d.loading=!1,e.$emit("event:policyUpdatedSuccess",o)}function c(e){r("moon.policy.edit.basic.error",{policyName:d.policy.name}).then(function(e){n.alertError(e)}),d.loading=!1}o.isInvalid(d.form)?o.checkFieldsValidity(d.form):(d.loading=!0,delete d.policyToEdit.model,d.policyToEdit.model_id=d.selectedModel.id,t.update(d.policyToEdit,i,c))}function u(){d.policyToEdit=angular.copy(d.policy)}var d=this;d.editPolicy=s,d.init=u,d.form={},d.modelsLoading=!0,function(){d.policy=e.edit.policy,d.policyToEdit=angular.copy(d.policy),console.log(d.policyToEdit),c()}()}angular.module("moon").directive("moonPolicyEditBasic",e),e.$inject=[],angular.module("moon").controller("moonPolicyEditBasicController",t),t.$inject=["$scope","policyService","formService","alertService","$translate","utilService","modelService"]}(),function(){"use strict";function e(e,t,o,n,r,a){function i(){function a(n){var r=n.project;t("moon.project.add.success",{projectName:r.name}).then(function(e){o.alertSuccess(e)}),c.loading=!1,e.$emit("event:projectCreatedSuccess",r)}function i(n){t("moon.project.add.error",{projectName:c.project.project.name}).then(function(e){o.alertError(e)}),c.loading=!1,e.$emit("event:projectCreatedError",c.project)}n.isInvalid(c.form)?n.checkFieldsValidity(c.form):(c.loading=!0,r.data.projects.create({},c.project,a,i))}var c=this;c.form={},c.loading=!1,c.project={project:{name:null,description:null,enabled:!0,domain:a.DOMAIN.DEFAULT}},c.create=i}angular.module("moon").controller("ProjectAddController",e),e.$inject=["$scope","$translate","alertService","formService","projectService","DEFAULT_CST"]}(),function(){"use strict";function e(e,t,o,n,r){function a(){r.findAllWithCallBack(function(e){u.pdps=e,r.mapPdpsToProject(u.project,u.pdps),u.loadingPDP=!1})}function i(){return _.has(u.project,"pdp")}function c(){u.loading=!0,i()?l(s):s()}function l(n){function a(n){t("moon.project.remove.mapping.remove.error",{pdpName:i}).then(function(e){o.alertError(e)}),u.loading=!1,e.$emit("event:projectDeletedError",u.project)}var i=unmap.project.pdp.name;r.unMap(unmap.project,n,a)}function s(){function r(n){t("moon.project.remove.success",{projectName:u.project.name}).then(function(e){o.alertSuccess(e)}),u.loading=!1,e.$emit("event:projectDeletedSuccess",u.project)}function a(n){t("moon.project.remove.error",{projectName:u.project.name,errorCode:n.data.error.code,message:n.data.error.message}).then(function(e){o.alertError(e)}),u.loading=!1,e.$emit("event:projectDeletedError",u.project)}n.data.projects.remove({project_id:u.project.id},r,a)}var u=this;u.project=e.project,u.loading=!1,u.loadingPDP=!0,u.remove=c,u.isProjectMapped=i,u.pdps=[],function(){a()}()}angular.module("moon").controller("ProjectDeleteController",e),e.$inject=["$scope","$translate","alertService","projectService","pdpService"]}(),function(){"use strict";function e(e,t,o,n,r){this.project=t.project}angular.module("moon").controller("ProjectViewController",e),e.$inject=["$q","$scope","$translate","alertService","projectService"]}(),function(){"use strict";function e(e){function t(t){e.pop("error",null,t,5e3)}function o(t){e.pop("success",null,t,5e3)}function n(t){e.pop("note",null,t,5e3)}var r={};return r.alertError=t,r.alertSuccess=o,r.alertInfo=n,r}angular.module("moon").factory("alertService",e),e.$inject=["toaster"]}(),function(){"use strict";function e(){function e(){var e,t=navigator.userAgent,o=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(o[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],"IE "+(e[1]||"")):"Chrome"===o[1]&&null!=(e=t.match(/\bOPR\/(\d+)/))?"Opera "+e[1]:(o=o[2]?[o[1],o[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&o.splice(1,1,e[1]),o.join(" "))}var t={};return t.sayWho=e,t}angular.module("moon").factory("browserService",e)}(),function(){"use strict";function e(){function e(e){return e.$invalid}function t(e){var t=_.keys(e.$error);_(t).each(function(t){ +var o=_.values(e.$error[t]);_(o).each(function(e){e.$dirty=!0,e.$setValidity(t,!1)})})}var o={};return o.isInvalid=e,o.checkFieldsValidity=t,o}angular.module("moon").factory("formService",e)}(),function(){"use strict";function e(e){function t(){return e.includes("moon.project")}function o(){return e.includes("moon.pdp")}function n(){return e.includes("moon.policy")}function r(){return e.includes("moon.logs")}function a(){return e.includes("moon.model")}var i={};return i.isProjectTabActive=t,i.isPDPTabActive=o,i.isPolicyTabActive=n,i.isLogsTabActive=r,i.isModelTabActive=a,i}angular.module("moon").factory("menuService",e),e.$inject=["$state"]}(),function(){"use strict";function e(e,t){function o(o){switch(o){case e.TYPE.POLICY:return t.findAll();default:return t.findAll()}}var n={};return n.findAll=o,n}angular.module("moon").factory("securityPipelineService",e),e.$inject=["SECURITY_PIPELINE_CST","policyService"]}(),function(){"use strict";function e(){return{transform:function(e,t){var o=[];return _.each(e[t],function(e,t){e.id=t,o.push(e)}),o},transformOne:function(e,t){var o=[];return _.each(e[t],function(e,t){e.id=t,o.push(e)}),o[0]}}}angular.module("moon").factory("utilService",e),e.$inject=[]}(),function(){"use strict";function e(e){return{version:e("version.json",{},{get:{method:"GET",isArray:!1}})}}angular.module("moon").factory("versionService",e),e.$inject=["$resource"]}(),function(){"use strict";function e(e,t,o,n){function r(e,t){_.each(e,function(e){return a(e,t)})}function a(e,t){if(_.isNull(e.keystone_project_id))return!1;var o=_.findIndex(t,function(t){return e.id===t.keystone_project_id});return o!==-1&&(e.pdp=t[o],!0)}return{data:{pdp:t(o.PDP+":pdp_id",{},{query:{method:"GET",isArray:!1},get:{method:"GET",isArray:!1},create:{method:"POST"},update:{method:"PATCH"},remove:{method:"DELETE"}})},findAll:function(){return this.data.pdp.query().$promise.then(function(e){return n.transform(e,"pdps")})},findAllWithCallBack:function(e){return this.data.pdp.query().$promise.then(function(t){e(n.transform(t,"pdps"))})},findOne:function(e){return this.data.pdp.get({pdp_id:e}).$promise.then(function(e){return n.transformOne(e,"pdps")})},unMap:function(e,t,o){e.keystone_project_id=null,_.has(e,"project")&&delete e.project,this.data.pdp.update({pdp_id:e.id},e,t,o)},map:function(e,t,o,n){e.keystone_project_id=t,this.data.pdp.update({pdp_id:e.id},e,o,n)},update:function(e,t,o){this.data.pdp.update({pdp_id:e.id},e,t,o)},mapPdpsToProjects:r,mapPdpsToProject:a}}angular.module("moon").factory("pdpService",e),e.$inject=["$q","$resource","REST_URI","utilService"]}(),function(){"use strict";function e(e,t,o,n,r){function a(){return _.has(o,"currentUser")}function i(){delete o.currentUser,n.defaults.headers.common["X-Auth-Token"]="",r.path("/")}function c(){return o.currentUser}function l(){return o.currentUser.connectionToken}function s(e){n.defaults.headers.common["X-Auth-Token"]=e}return{data:e(t.KEYSTONE+"auth/tokens",{},{login:{method:"POST",transformResponse:function(e,t){var o={};return o.data=angular.fromJson(e),o.headers=t(),o}},logout:{method:"DELETE"}}),Login:function(e,t,n){var r={auth:{identity:{methods:["password"],password:{user:{name:e.username,domain:{name:"Default"},password:e.password}}},scope:{project:{name:"admin",domain:{name:"Default"}}}}};this.data.login({},r,function(e){o.currentUser=e.data,o.currentUser.connectionToken=e.headers["x-subject-token"],s(e.headers["x-subject-token"]),t()},n)},IsConnected:a,SetTokenHeader:s,GetTokenHeader:l,GetUser:c,Logout:i}}angular.module("moon").factory("authenticationService",e),e.$inject=["$resource","REST_URI","$sessionStorage","$http","$location"]}(),function(){"use strict";function e(e){return{data:{image:e("./pip/nova/images",{},{query:{method:"GET",isArray:!1}}),flavor:e("./pip/nova/flavors",{},{query:{method:"GET",isArray:!1}})}}}angular.module("moon").factory("novaService",e),e.$inject=["$resource"]}(),function(){"use strict";function e(e,t){return{data:{projects:e(t.KEYSTONE+"projects/:project_id",{},{query:{method:"GET",isArray:!1},get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})},findOne:function(e,t){return this.data.projects.get({project_id:e}).$promise.then(function(e){t(e.project)})},findAll:function(){return this.data.projects.query().$promise.then(function(e){var t=[];return _.each(e.projects,function(e){t.push(e)}),t})}}}angular.module("moon").factory("projectService",e),e.$inject=["$resource","REST_URI"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/metadata/metadata-edit.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{metaDataType:"=",metaRule:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c){function l(){function e(e){g.list=e}switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.findAllWithCallback(e);break;case o.TYPE.OBJECT:t.object.findAllWithCallback(e);break;case o.TYPE.ACTION:t.action.findAllWithCallback(e);break;default:g.list=[]}}function s(){function t(t){r("moon.model.metarules.update.success",{metaRuleName:l.name}).then(function(e){n.alertSuccess(e)}),l=c.transformOne(t,"meta_rules"),e.$emit("event:updateMetaRuleFromMetaDataAddSuccess",l),f()}function a(e){r("moon.model.metarules.update.error",{metaRuleName:l.name,reason:e.message}).then(function(e){n.alertError(e)}),f()}if(g.selectedMetaData){var l=g.metaRule;switch(g.metaDataType){case o.TYPE.SUBJECT:l.subject_categories.push(g.selectedMetaData.id);break;case o.TYPE.OBJECT:l.object_categories.push(g.selectedMetaData.id);break;case o.TYPE.ACTION:l.action_categories.push(g.selectedMetaData.id)}i.update(l,t,a)}}function u(){function e(e){var t={};switch(g.metaDataType){case o.TYPE.SUBJECT:t=c.transformOne(e,"subject_categories");break;case o.TYPE.OBJECT:t=c.transformOne(e,"object_categories");break;case o.TYPE.ACTION:t=c.transformOne(e,"action_categories")}r("moon.model.metadata.edit.create.success",{name:t.name}).then(function(e){n.alertSuccess(e)}),f(),g.list.push(t),h()}function i(e){r("moon.model.metadata.edit.create.error",{name:l.name}).then(function(e){n.alertError(e)}),f()}if(a.isInvalid(g.form))a.checkFieldsValidity(g.form);else{p();var l=angular.copy(g.metaData);switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.add(l,e,i);break;case o.TYPE.OBJECT:t.object.add(l,e,i);break;case o.TYPE.ACTION:t.action.add(l,e,i)}}}function d(){function a(t){r("moon.model.metadata.edit.delete.success",{name:s.name}).then(function(e){n.alertSuccess(e)}),i.findOneWithMetaData(g.metaRule.id).then(function(t){g.metaRule=t,m(),l(),f(),e.$emit("event:deleteMetaDataFromMetaDataAddSuccess",g.metaRule)})}function c(e){r("moon.model.metadata.edit.delete.error",{name:s.name}).then(function(e){n.alertError(e)}),f()}if(g.selectedMetaData){p();var s=angular.copy(g.selectedMetaData);switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.delete(s,a,c);break;case o.TYPE.OBJECT:t.object.delete(s,a,c);break;case o.TYPE.ACTION:t.action.delete(s,a,c)}}}function m(){delete g.selectedMetaData}function p(){g.loading=!0}function f(){g.loading=!1}function h(){g.fromList=!0}var g=this;g.metaDataType=e.edit.metaDataType,g.metaRule=e.edit.metaRule,g.fromList=!0,g.laoading=!1,g.form={},g.metaData={name:null,description:null},g.list=[],g.create=u,g.addToMetaRule=s,g.deleteMetaData=d,l()}angular.module("moon").directive("moonMetaDataEdit",e),e.$inject=[],angular.module("moon").controller("moonMetaDataEditController",t),t.$inject=["$scope","metaDataService","META_DATA_CST","alertService","$translate","formService","metaRuleService","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/metadata/metadata-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{metaRule:"=",editMode:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c){function l(){s(),u(),d()}function s(){C.loadingCatSub=!0,o.subject.findSomeWithCallback(C.metaRule.subject_categories,function(e){C.catSub=e,C.loadingCatSub=!1})}function u(){C.loadingCatObj=!0,o.object.findSomeWithCallback(C.metaRule.object_categories,function(e){C.catObj=e,C.loadingCatObj=!1})}function d(){C.loadingCatAct=!0,o.action.findSomeWithCallback(C.metaRule.action_categories,function(e){C.catAct=e,C.loadingCatAct=!1})}function m(e){function t(t){n("moon.model.metarules.update.success",{metaRuleName:C.metaRule.name}).then(function(e){r.alertSuccess(e)}),C.metaRule=a.findMetaDataFromMetaRule(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.model.metarules.update.error",{metaRuleName:C.metaRule.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(C.metaRule);i.subject_categories=_.without(i.subject_categories,e.id),a.update(i,t,o)}function p(e){function t(t){n("moon.model.metarules.update.success",{metaRuleName:C.metaRule.name}).then(function(e){r.alertSuccess(e)}),C.metaRule=a.findMetaDataFromMetaRule(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.model.metarules.update.error",{metaRuleName:C.metaRule.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(C.metaRule);i.object_categories=_.without(i.object_categories,e.id),a.update(i,t,o)}function f(e){function t(t){n("moon.model.metarules.update.success",{metaRuleName:C.metaRule.name}).then(function(e){r.alertSuccess(e)}),C.metaRule=a.findMetaDataFromMetaRule(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.model.metarules.update.error",{metaRuleName:C.metaRule.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(C.metaRule);i.action_categories=_.without(i.action_categories,e.id),a.update(i,t,o)}function h(e){function t(t){n("moon.model.metadata.subject.delete.success",{subjectName:e.name}).then(function(e){r.alertSuccess(e)}),S(e),e.loader=!1}function a(t){n("moon.model.metadata.subject.delete.error",{subjectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.subject.delete(e,t,a)}function g(e){function t(t){n("moon.model.metadata.object.delete.success",{objectName:e.name}).then(function(e){r.alertSuccess(e)}),$(e),C.catSub=o.subject.findSome(metaRule.subject_categories),C.catObj=o.object.findSome(metaRule.object_categories),C.catAct=o.action.findSome(metaRule.action_categories),e.loader=!1}function a(t){n("moon.model.metadata.object.delete.error",{objectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.object.delete(e,t,a)}function v(e){function t(t){n("moon.model.metadata.action.delete.success",{actionName:e.name}).then(function(e){r.alertSuccess(e)}),E(e),e.loader=!1}function a(t){n("moon.model.metadata.action.delete.error",{actionName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.action.delete(e,t,a)}function y(){return C.catSub?C.catSub:[]}function j(){return C.catObj?C.catObj:[]}function b(){return C.catAct?C.catAct:[]}function S(e){C.catSub=_.without(C.catSub,e)}function $(e){C.catObj=_.without(C.catObj,e)}function E(e){C.catAct=_.without(C.catAct,e)}function P(e,t){C.metaRule=t,l()}function T(e,t){C.metaRule=t,l()}var C=this;C.metaRule=e.list.metaRule,C.editMode=e.list.editMode,C.typeOfSubject=i.TYPE.SUBJECT,C.typeOfObject=i.TYPE.OBJECT,C.typeOfAction=i.TYPE.ACTION,C.unMapSub=m,C.unMapObj=p,C.unMapAct=f,C.deleteSub=h,C.deleteObj=g,C.deleteAct=v,C.getSubjectCategories=y,C.getObjectCategories=j,C.getActionCategories=b,l();var O={"event:updateMetaRuleFromMetaDataAddSuccess":t.$on("event:updateMetaRuleFromMetaDataAddSuccess",P),"event:deleteMetaDataFromMetaDataAddSuccess":t.$on("event:deleteMetaDataFromMetaDataAddSuccess",T)};for(var M in O)e.$on("$destroy",O[M])}angular.module("moon").directive("moonMetaDataList",e),e.$inject=[],angular.module("moon").controller("moonMetaDataListController",t),t.$inject=["$scope","$rootScope","metaDataService","$translate","alertService","metaRuleService","META_DATA_CST","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/metarules/metarules-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{editMode:"=",mappedModel:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(){return _.table=new o({page:1,count:10,sorting:{name:"asc"}},{total:function(){return _.getMetaRules().length},getData:function(e,t){var o=t.sorting()?n("orderBy")(_.getMetaRules(),t.orderBy()):_.getMetaRules();e.resolve(o.slice((t.page()-1)*t.count(),t.page()*t.count()))},$scope:{$data:{}}}),_.table}function c(){return _.metaRules?_.metaRules:[]}function l(){return _.getMetaRules().length>0}function s(e){e.id===d().id?(_.showDetailValue=!1,_.subject_list=[],_.object_list=[],_.action_list=[]):(_.subject_list=e.subject_categories_values,_.object_list=e.object_categories_values,_.action_list=e.action_categories_values,_.showDetailValue=e)}function u(e){_.edit.modal.$scope.metaRule=e,_.edit.modal.$promise.then(_.edit.modal.show)}function d(){return _.showDetailValue}function m(){return _.subject_list}function p(){return _.object_list}function f(){return _.action_list}function h(){_.map.modal.$scope.model=_.model,_.map.modal.$promise.then(_.map.modal.show)}function g(){_.metaRules=_.model.meta_rules_values,_.table.total(_.getMetaRules().length),_.table.reload()}function v(e,t){_.model=t,g(),_.map.modal.hide()}function y(e){_.unmap.modal.$scope.model=_.model,_.unmap.modal.$scope.metaRule=e,_.unmap.modal.$promise.then(_.unmap.modal.show)}function j(e,t){_.model=t,a.findSomeWithCallback(_.model.meta_rules,function(e){_.model.meta_rules_values=e,g(),_.unmap.modal.hide()})}function b(e){_.unmap.modal.hide()}var _=this;_.table={},_.editMode=e.list.editMode,_.model=e.list.mappedModel,_.metaRules=_.model.meta_rules_values,_.getMetaRules=c,_.hasMetaRules=l,_.showDetail=s,_.getSubjectList=m,_.getObjectList=p,_.getActionlist=f,_.getShowDetailValue=d,_.showDetailValue=!1,_.subject_list=[],_.object_list=[],_.action_list=[],_.edit={modal:r({template:"html/model/edit/metarules/action/metarules-edit.tpl.html",show:!1}),showModal:u},_.map={modal:r({template:"html/model/edit/metarules/action/mapping/metarules-map.tpl.html",show:!1}),showModal:h},_.unmap={modal:r({template:"html/model/edit/metarules/action/mapping/metarules-unmap.tpl.html",show:!1}),showModal:y},function(){i()}();var S={"event:metaRuleMapToModelSuccess":t.$on("event:metaRuleMapToModelSuccess",v),"event:metaRuleUnMappedToModelSuccess":t.$on("event:metaRuleUnMappedToModelSuccess",j),"event:metaRuleUnMappedToModelError":t.$on("event:metaRuleUnMappedToModelError",b)};for(var $ in S)e.$on("$destroy",S[$]);e.$watch("list.editMode",function(e,t){_.showDetailValue=!1})}angular.module("moon").directive("moonMetaRulesList",e),e.$inject=[],angular.module("moon").controller("moonMetaRulesListController",t),t.$inject=["$scope","$rootScope","NgTableParams","$filter","$modal","metaRuleService"]}(),function(){"use strict";function e(e,t,o,n,r,a,i){function c(){s.policiesLoading=!0,r.findAllWithCallback(function(e){s.policies=e,s.policiesLoading=!1})}function l(){function r(n){var r=i.transformOne(n,"pdps");o("moon.policy.map.success",{pdpName:r.name,policyName:s.selectedPolicy.name}).then(function(e){t.alertSuccess(e)}),s.mappingLoading=!1,e.$emit("event:policyMapToPdpSuccess",r)}function c(n){o("moon.policy.map.error",{pdpName:s.pdp.name,policyName:s.selectedPolicy.name}).then(function(e){t.alertError(e)}),s.mappingLoading=!1,e.$emit("event:policyMapToPdpError")}if(n.isInvalid(s.form))n.checkFieldsValidity(s.form);else{s.mappingLoading=!0;var l=angular.copy(s.pdp);l.security_pipeline.push(s.selectedPolicy.id),a.update(l,r,c)}}var s=this;s.pdps=[],s.pdp=e.pdp,s.addPolicyToList=!1,s.map=l,function(){c()}()}angular.module("moon").controller("PolicyMapController",e),e.$inject=["$scope","alertService","$translate","formService","policyService","pdpService","utilService"]}(),function(){"use strict";function e(e,t,o,n,r){function a(){function a(n){t("moon.policy.unmap.success",{pdpName:i.pdp.name,policyName:i.policy.name}).then(function(e){o.alertSuccess(e)}),i.unMappingLoading=!1,e.$emit("event:policyUnMappedToPdpSuccess",r.transformOne(n,"pdps"))}function c(n){t("moon.policy.unmap.error",{pdpName:i.pdp.name,policyName:i.policy.name}).then(function(e){o.alertError(e)}),i.unMappingLoading=!1,e.$emit("event:policyUnMappedToPdpError")}i.unMappingLoading=!0;var l=angular.copy(i.pdp);l.security_pipeline=_.without(l.security_pipeline,i.policy.id),n.update(l,a,c)}var i=this;i.pdp=e.pdp,i.policy=e.policy,i.unMappingLoading=!1,i.unmap=a}angular.module("moon").controller("PolicyUnMapController",e),e.$inject=["$scope","$translate","alertService","pdpService","utilService"]}(),function(){"use strict";function e(e,t,o,n,r){function a(){r.findAllWithCallBack(i)}function i(e){l.pdps=_.filter(e,function(e){return _.isNull(e.keystone_project_id)}),l.pdpsLoading=!1}function c(){function a(n){l.project.pdp=l.selectedPDP,t("moon.project.map.success",{projectName:l.project.name,pdpName:l.selectedPDP.name}).then(function(e){o.alertSuccess(e)}),l.mappingLoading=!1,e.$emit("event:projectMappedSuccess",l.project)}function i(n){t("moon.project.map.error",{projectName:l.project.name,pdpName:l.selectedPDP.name}).then(function(e){o.alertError(e)}),l.mappingLoading=!1,e.$emit("event:projectMappedError",l.project)}n.isInvalid(l.form)?n.checkFieldsValidity(l.form):(l.mappingLoading=!0,r.map(l.selectedPDP,l.project.id,a,i))}var l=this;l.form={},l.project=e.project,l.pdps=[],l.pdpsLoading=!0,l.selectedPDP=null,l.map=c,function(){a()}()}angular.module("moon").controller("ProjectMapController",e),e.$inject=["$scope","$translate","alertService","formService","pdpService"]}(),function(){"use strict";function e(e,t,o,n){function r(){function r(n){t("moon.project.unmap.success",{projectName:a.project.name,pdpName:c}).then(function(e){o.alertSuccess(e)}),a.unMappingLoading=!1,delete a.project.mapping,delete a.project.pdp,e.$emit("event:projectUnmappedSuccess",a.project)}function i(n){t("moon.project.unmap.error",{projectName:a.project.name,pdpName:c}).then(function(e){o.alertError(e)}),a.unMappingLoading=!1,e.$emit("event:projectUnmappedError",a.project)}a.unMappingLoading=!0;var c=a.project.pdp.name;n.unMap(a.project.pdp,r,i)}var a=this;a.project=e.project,a.unMappingLoading=!1,a.unmap=r}angular.module("moon").controller("ProjectUnMapController",e),e.$inject=["$scope","$translate","alertService","pdpService"]}(),function(){"use strict";function e(e,t,o,n){return{data:e(t.MODELS+":model_id",{},{get:{method:"GET"},query:{method:"GET"},create:{method:"POST"},remove:{method:"DELETE"},update:{method:"PATCH"}}),findAll:function(){return this.data.query().$promise.then(function(e){return n.transform(e,"models")})},findAllWithCallBack:function(e){return this.data.query().$promise.then(function(t){e(n.transform(t,"models"))})},findOneWithCallback:function(e,t){return this.data.get({model_id:e}).$promise.then(function(e){t(n.transformOne(e,"models"))})},findOneWithMetaRules:function(e){return this.data.get({model_id:e}).$promise.then(function(t){var r=n.transformOne(t,"models");return r.meta_rules.length>0?o.findSomeWithMetaData(r.meta_rules).then(function(t){return r.meta_rules_values=t,r.id=e,r}):(r.meta_rules_values=[],r.id=e),r})},delete:function(e,t,o){delete e.meta_rules_values,this.data.remove({model_id:e.id},e,t,o)},update:function(e,t,o){delete e.meta_rules_values,this.data.update({model_id:e.id},e,t,o)}}}angular.module("moon").factory("modelService",e),e.$inject=["$resource","REST_URI","metaRuleService","utilService"]}(),function(){"use strict";function e(e,t,o,n){return{data:{policy:e(t.POLICIES+":policy_id",{},{query:{method:"GET"},create:{method:"POST"},update:{method:"PATCH"},remove:{method:"DELETE"}})},findAll:function(){return this.data.policy.query().$promise.then(function(e){return o.transform(e,"policies")})},findAllWithCallback:function(e){return this.data.policy.query().$promise.then(function(t){e(o.transform(t,"policies"))})},findOneReturningPromise:function(e){return this.data.policy.get({policy_id:e}).$promise},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});n.all(a).then(function(e){t(_(e).map(function(e){return o.transformOne(e,"policies")}))})},findOne:function(e){return this.data.policy.get({policy_id:e}).$promise.then(function(e){return o.transformOne(e,"policies")})},update:function(e,t,o){this.data.policy.update({policy_id:e.id},e,t,o)},delete:function(e,t,o){this.data.policy.remove({policy_id:e.id},e,t,o)}}}angular.module("moon").factory("policyService",e),e.$inject=["$resource","REST_URI","utilService","$q"]}(),function(){"use strict";function e(e,t,o,n){var r={subject:e(t.METADATA.subject+":subject_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}}),object:e(t.METADATA.object+":object_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}}),action:e(t.METADATA.action+":action_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})};return{subject:{findOne:function(e,t){r.subject.get({subject_id:e}).$promise.then(function(e){t(n.transformOne(e,"subject_categories"))})},findOneReturningPromise:function(e){return r.subject.get({subject_id:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"subject_categories")})})},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});o.all(a).then(function(e){t(_(e).map(function(e){return n.transformOne(e,"subject_categories")}))})},findAll:function(){return r.subject.get().$promise.then(function(e){return n.transform(e,"subject_categories")})},findAllWithCallback:function(e){return r.subject.get().$promise.then(function(t){e(n.transform(t,"subject_categories"))})},delete:function(e,t,o){r.subject.remove({subject_id:e.id},e,t,o)},add:function(e,t,o){r.subject.create({},e,t,o)}},object:{findOne:function(e,t){r.object.get({object_id:e}).$promise.then(function(e){t(n.transformOne(e,"object_categories"))})},findOneReturningPromise:function(e){return r.object.get({object_id:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"object_categories")})})},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});o.all(a).then(function(e){t(_(e).map(function(e){return n.transformOne(e,"object_categories")}))})},findAll:function(){return r.object.get().$promise.then(function(e){return n.transform(e,"object_categories")})},findAllWithCallback:function(e){return r.object.get().$promise.then(function(t){e(n.transform(t,"object_categories"))})},delete:function(e,t,o){r.object.remove({object_id:e.id},e,t,o)},add:function(e,t,o){r.object.create({},e,t,o)}},action:{findOne:function(e,t){r.action.get({actionId:e}).$promise.then(function(e){t(n.transformOne(e,"action_categories"))})},findOneReturningPromise:function(e){return r.action.get({actionId:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"action_categories")})})},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});o.all(a).then(function(e){t(_(e).map(function(e){return n.transformOne(e,"action_categories")}))})},findAll:function(){return r.action.get().$promise.then(function(e){return n.transform(e,"action_categories")})},findAllWithCallback:function(e){return r.action.get().$promise.then(function(t){e(n.transform(t,"action_categories"))})},delete:function(e,t,o){r.action.remove({action_id:e.id},e,t,o)},add:function(e,t,o){r.action.create({},e,t,o)}}}}angular.module("moon").factory("metaDataService",e),e.$inject=["$resource","REST_URI","$q","utilService"]}(),function(){"use strict";function e(e,t,o,n,r){return{data:e(t.METARULES+":metarule_id",{},{query:{method:"GET"},get:{method:"GET",isArray:!1},update:{method:"PATCH"},create:{method:"POST"},remove:{method:"DELETE"}}),findAll:function(){return this.data.query().$promise.then(function(e){return r.transform(e,"meta_rules")})},findAllWithCallback:function(e){this.data.query().$promise.then(function(t){e(r.transform(t,"meta_rules"))})},findSomeWithMetaData:function(e){var t=this;if(0===e.length)return[];var o=_(e).map(function(e){return t.findOneReturningPromise(e)});return n.all(o).then(function(e){return _(e).map(function(e){var o=r.transformOne(e,"meta_rules");return o=t.findMetaDataFromMetaRule(o)})})},findSomeWithCallback:function(e,t){var o=this;if(0===e.length)return[];var a=_(e).map(function(e){return o.findOneReturningPromise(e)});return n.all(a).then(function(e){t(_(e).map(function(e){return r.transformOne(e,"meta_rules")}))})},findOneReturningPromise:function(e){return this.data.get({metarule_id:e}).$promise},findOne:function(e){return this.data.get({metarule_id:e}).$promise.then(function(e){return r.transformOne(e,"meta_rules")})},findOneWithCallback:function(e,t){this.data.get({metarule_id:e}).$promise.then(function(e){t(r.transformOne(e,"meta_rules"))})},findOneWithMetaData:function(e){var t=this;return this.data.get({metarule_id:e}).$promise.then(function(e){var o=r.transformOne(e,"meta_rules");return o=t.findMetaDataFromMetaRule(o)})},findMetaDataFromMetaRule:function(e){return e.subject_categories.length>0?o.subject.findSome(e.subject_categories).then(function(t){e.subject_categories_values=t}):e.subject_categories_values=[],e.object_categories.length>0?o.object.findSome(e.object_categories).then(function(t){e.object_categories_values=t}):e.object_categories_values=[],e.action_categories.length>0?o.action.findSome(e.action_categories).then(function(t){e.action_categories_values=t}):e.action_categories_values=[],e},delete:function(e,t,o){this.data.remove({metarule_id:e.id},e,t,o)},update:function(e,t,o){delete e.subject_categories_values,delete e.object_categories_values,delete e.action_categories_values,this.data.update({metarule_id:e.id},e,t,o)}}}angular.module("moon").factory("metaRuleService",e),e.$inject=["$resource","REST_URI","metaDataService","$q","utilService"]}(),function(){"use strict";function e(e,t){function o(e,t){n.metaRule=t}var n=this;n.metaRule=e.metaRule;var r={"event:metaRuleBasicUpdatedSuccess":t.$on("event:metaRuleBasicUpdatedSuccess",o)};for(var a in r)e.$on("$destroy",r[a])}angular.module("moon").controller("MetaRulesEditController",e),e.$inject=["$scope","$rootScope"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/metarules/action/metarules-edit-basic.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{metaRule:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(){function i(t){var o=a.transformOne(t,"meta_rules");r("moon.model.metarules.edit.basic.success",{metaRuleName:o.name}).then(function(e){n.alertSuccess(e)}),l.loading=!1,e.$emit("event:metaRuleBasicUpdatedSuccess",o)}function c(e){r("moon.model.edit.basic.error",{metaRuleName:l.metaRule.name}).then(function(e){n.alertError(e)}),l.loading=!1}o.isInvalid(l.form)?o.checkFieldsValidity(l.form):(l.loading=!0,t.update(l.metaRuleToEdit,i,c))}function c(){l.metaRuleToEdit=angular.copy(l.metaRule)}var l=this;l.editMetaRule=i,l.init=c,l.form={},function(){l.metaRule=e.edit.metaRule,l.metaRuleToEdit=angular.copy(l.metaRule)}()}angular.module("moon").directive("moonMetaRulesEditBasic",e),e.$inject=[],angular.module("moon").controller("moonMetaRulesEditBasicController",t),t.$inject=["$scope","metaRuleService","formService","alertService","$translate","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/parameter/assignments/assignments-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{policy:"=",editMode:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c,l,s,u){function d(){m(),p(),f()}function m(){D.loadingSub=!0,o.subject.findAllFromPolicyWithCallback(D.policy.id,function(e){console.log("subjects"),console.log(e),D.subjects=e,D.loadingSub=!1})}function p(){D.loadingObj=!0,o.object.findAllFromPolicyWithCallback(D.policy.id,function(e){console.log("objects"),console.log(e),D.objects=e,D.loadingObj=!1})}function f(){D.loadingAct=!0,o.action.findAllFromPolicyWithCallback(D.policy.id,function(e){console.log("actions"),console.log(e),D.actions=e,D.loadingAct=!1})}function h(e,t){function o(t){e.callPerimeterInProgress=!1,e.perimeter=t}if(_.has(e,"perimeter"))return e.perimeter;if(!_.has(e,"callPerimeterInProgress"))switch(e.callPerimeterInProgress=!0,t){case i.TYPE.SUBJECT:s.subject.findOneFromPolicyWithCallback(D.policy.id,e.subject_id,o);break;case i.TYPE.OBJECT:s.object.findOneFromPolicyWithCallback(D.policy.id,e.object_id,o);break;case i.TYPE.ACTION:s.action.findOneFromPolicyWithCallback(D.policy.id,e.action_id,o)}return!1}function g(e,t){function o(t){e.callCategoryInProgress=!1,e.category=t}if(_.has(e,"category"))return e.category;if(!_.has(e,"callCategoryInProgress"))switch(e.callCategoryInProgress=!0,t){case i.TYPE.SUBJECT:l.subject.findOne(e.subject_cat_id,o);break;case i.TYPE.OBJECT:l.object.findOne(e.object_cat_id,o);break;case i.TYPE.ACTION:l.action.findOne(e.action_cat_id,o)}return!1}function v(e,t,o){function n(o){t.assignments_value[e].callDataInProgress=!1,t.assignments_value[e].data=o}if(_.has(t,"assignments_value")||(t.assignments_value=Array.apply(null,new Array(t.assignments.length)).map(function(){return{data:{}}})),_.has(t.assignments_value[e],"callDataInProgress")&&!t.assignments_value[e].callDataInProgress)return t.assignments_value[e].data;if(!_.has(t.assignments_value[e],"callDataInProgress"))switch(t.assignments_value[e].callDataInProgress=!0,o){case i.TYPE.SUBJECT:u.subject.data.findOne(D.policy.id,t.category_id,t.assignments[e],n);break;case i.TYPE.OBJECT:u.object.data.findOne(D.policy.id,t.category_id,t.assignments[e],n);break;case i.TYPE.ACTION:u.action.data.findOne(D.policy.id,t.category_id,t.assignments[e],n)}return!1}function y(e){function t(t){n("moon.policy.metarules.update.success",{policyName:D.policy.name}).then(function(e){r.alertSuccess(e)}),D.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),d(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:D.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(D.policy);i.subject_categories=_.without(i.subject_categories,e.id),a.update(i,t,o)}function j(e){function t(t){n("moon.policy.metarules.update.success",{policyName:D.policy.name}).then(function(e){r.alertSuccess(e)}),D.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),d(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:D.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(D.policy);i.object_categories=_.without(i.object_categories,e.id),a.update(i,t,o)}function b(e){function t(t){n("moon.policy.metarules.update.success",{policyName:D.policy.name}).then(function(e){r.alertSuccess(e)}),D.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),d(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:D.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(D.policy);i.action_categories=_.without(i.action_categories,e.id),a.update(i,t,o)}function S(e){function t(t){n("moon.policy.perimeter.subject.delete.success",{ +subjectName:e.name}).then(function(e){r.alertSuccess(e)}),O(e),e.loader=!1}function a(t){n("moon.policy.perimeter.subject.delete.error",{subjectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.subject.delete(e,t,a)}function $(e){function t(t){n("moon.policy.perimeter.object.delete.success",{objectName:e.name}).then(function(e){r.alertSuccess(e)}),M(e),e.loader=!1}function a(t){n("moon.policy.perimeter.object.delete.error",{objectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.object.delete(e,t,a)}function E(e){function t(t){n("moon.policy.perimeter.action.delete.success",{actionName:e.name}).then(function(e){r.alertSuccess(e)}),A(e),e.loader=!1}function a(t){n("moon.policy.perimeter.action.delete.error",{actionName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.action.delete(e,t,a)}function P(){return D.subjects?D.subjects:[]}function T(){return D.objects?D.objects:[]}function C(){return D.actions?D.actions:[]}function O(e){D.subjects=_.without(D.subjects,e)}function M(e){D.objects=_.without(D.objects,e)}function A(e){D.actions=_.without(D.actions,e)}function R(e,t){D.policy=t,d()}var D=this;D.policy=e.list.policy,D.editMode=e.list.editMode,D.typeOfSubject=i.TYPE.SUBJECT,D.typeOfObject=i.TYPE.OBJECT,D.typeOfAction=i.TYPE.ACTION,D.unMapSub=y,D.unMapObj=j,D.unMapAct=b,D.deleteSub=S,D.deleteObj=$,D.deleteAct=E,D.getSubjects=P,D.getObjects=T,D.getActions=C,D.getCategoryFromAssignment=g,D.getPerimeterFromAssignment=h,D.getDataFromAssignmentsIndex=v,d();var N={"event:deleteDataFromDataAddSuccess":t.$on("event:deleteDataFromDataAddSuccess",R)};for(var w in N)e.$on("$destroy",N[w])}angular.module("moon").directive("moonAssignmentsList",e),e.$inject=[],angular.module("moon").controller("moonAssignmentsListController",t),t.$inject=["$scope","$rootScope","assignmentService","$translate","alertService","policyService","ASSIGNMENTS_CST","utilService","metaDataService","perimeterService","dataService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/parameter/data/data-edit.tpl.html",bindToController:!0,controller:t,controllerAs:"edit",scope:{metaDataType:"=",metaRule:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c){function l(){function e(e){g.list=e}switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.findAllWithCallback(e);break;case o.TYPE.OBJECT:t.object.findAllWithCallback(e);break;case o.TYPE.ACTION:t.action.findAllWithCallback(e);break;default:g.list=[]}}function s(){function t(t){r("moon.model.metarules.update.success",{metaRuleName:l.name}).then(function(e){n.alertSuccess(e)}),l=c.transformOne(t,"meta_rules"),e.$emit("event:updateMetaRuleFromMetaDataAddSuccess",l),f()}function a(e){r("moon.model.metarules.update.error",{metaRuleName:l.name,reason:e.message}).then(function(e){n.alertError(e)}),f()}if(g.selectedMetaData){var l=g.metaRule;switch(g.metaDataType){case o.TYPE.SUBJECT:l.subject_categories.push(g.selectedMetaData.id);break;case o.TYPE.OBJECT:l.object_categories.push(g.selectedMetaData.id);break;case o.TYPE.ACTION:l.action_categories.push(g.selectedMetaData.id)}i.update(l,t,a)}}function u(){function e(e){var t={};switch(g.metaDataType){case o.TYPE.SUBJECT:t=c.transformOne(e,"subject_categories");break;case o.TYPE.OBJECT:t=c.transformOne(e,"object_categories");break;case o.TYPE.ACTION:t=c.transformOne(e,"action_categories")}r("moon.model.metadata.edit.create.success",{name:t.name}).then(function(e){n.alertSuccess(e)}),f(),g.list.push(t),h()}function i(e){r("moon.model.metadata.edit.create.error",{name:l.name}).then(function(e){n.alertError(e)}),f()}if(a.isInvalid(g.form))a.checkFieldsValidity(g.form);else{p();var l=angular.copy(g.metaData);switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.add(l,e,i);break;case o.TYPE.OBJECT:t.object.add(l,e,i);break;case o.TYPE.ACTION:t.action.add(l,e,i)}}}function d(){function a(t){r("moon.model.metadata.edit.delete.success",{name:s.name}).then(function(e){n.alertSuccess(e)}),i.findOneWithMetaData(g.metaRule.id).then(function(t){g.metaRule=t,m(),l(),f(),e.$emit("event:deleteMetaDataFromMetaDataAddSuccess",g.metaRule)})}function c(e){r("moon.model.metadata.edit.delete.error",{name:s.name}).then(function(e){n.alertError(e)}),f()}if(g.selectedMetaData){p();var s=angular.copy(g.selectedMetaData);switch(g.metaDataType){case o.TYPE.SUBJECT:t.subject.delete(s,a,c);break;case o.TYPE.OBJECT:t.object.delete(s,a,c);break;case o.TYPE.ACTION:t.action.delete(s,a,c)}}}function m(){delete g.selectedMetaData}function p(){g.loading=!0}function f(){g.loading=!1}function h(){g.fromList=!0}var g=this;g.metaDataType=e.edit.metaDataType,g.metaRule=e.edit.metaRule,g.fromList=!0,g.laoading=!1,g.form={},g.metaData={name:null,description:null},g.list=[],g.create=u,g.addToMetaRule=s,g.deleteMetaData=d,l()}angular.module("moon").directive("moonDataEdit",e),e.$inject=[],angular.module("moon").controller("moonDataEditController",t),t.$inject=["$scope","metaDataService","DATA_CST","alertService","$translate","formService","policyService","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/parameter/data/data-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{policy:"=",editMode:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c,l){function s(){u(),d(),m()}function u(){O.loadingSub=!0,o.subject.findAllFromPolicyWithCallback(O.policy.id,function(e){console.log("subjects"),console.log(e),O.subjects=e,O.loadingSub=!1})}function d(){O.loadingObj=!0,o.object.findAllFromPolicyWithCallback(O.policy.id,function(e){console.log("objects"),console.log(e),O.objects=e,O.loadingObj=!1})}function m(){O.loadingAct=!0,o.action.findAllFromPolicyWithCallback(O.policy.id,function(e){console.log("actions"),console.log(e),O.actions=e,O.loadingAct=!1})}function p(e,t){function o(t){e.callCategoryInProgress=!1,e.category=t}if(_.has(e,"category"))return e.category;if(!_.has(e,"callCategoryInProgress"))switch(e.callCategoryInProgress=!0,t){case i.TYPE.SUBJECT:l.subject.findOne(e.category_id,o);break;case i.TYPE.OBJECT:l.object.findOne(e.category_id,o);break;case i.TYPE.ACTION:l.action.findOne(e.category_id,o)}return!1}function f(e){function t(t){n("moon.policy.metarules.update.success",{policyName:O.policy.name}).then(function(e){r.alertSuccess(e)}),O.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),s(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:O.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(O.policy);i.subject_categories=_.without(i.subject_categories,e.id),a.update(i,t,o)}function h(e){function t(t){n("moon.policy.metarules.update.success",{policyName:O.policy.name}).then(function(e){r.alertSuccess(e)}),O.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),s(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:O.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(O.policy);i.object_categories=_.without(i.object_categories,e.id),a.update(i,t,o)}function g(e){function t(t){n("moon.policy.metarules.update.success",{policyName:O.policy.name}).then(function(e){r.alertSuccess(e)}),O.policy=a.findDataFromPolicy(c.transformOne(t,"meta_rules")),s(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:O.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(O.policy);i.action_categories=_.without(i.action_categories,e.id),a.update(i,t,o)}function v(e){function t(t){n("moon.policy.perimeter.subject.delete.success",{subjectName:e.name}).then(function(e){r.alertSuccess(e)}),E(e),e.loader=!1}function a(t){n("moon.policy.perimeter.subject.delete.error",{subjectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.subject.delete(e,t,a)}function y(e){function t(t){n("moon.policy.perimeter.object.delete.success",{objectName:e.name}).then(function(e){r.alertSuccess(e)}),P(e),e.loader=!1}function a(t){n("moon.policy.perimeter.object.delete.error",{objectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.object.delete(e,t,a)}function j(e){function t(t){n("moon.policy.perimeter.action.delete.success",{actionName:e.name}).then(function(e){r.alertSuccess(e)}),T(e),e.loader=!1}function a(t){n("moon.policy.perimeter.action.delete.error",{actionName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.action.delete(e,t,a)}function b(){return O.subjects?O.subjects:[]}function S(){return O.objects?O.objects:[]}function $(){return O.actions?O.actions:[]}function E(e){O.subjects=_.without(O.subjects,e)}function P(e){O.objects=_.without(O.objects,e)}function T(e){O.actions=_.without(O.actions,e)}function C(e,t){O.policy=t,s()}var O=this;O.policy=e.list.policy,O.editMode=e.list.editMode,O.typeOfSubject=i.TYPE.SUBJECT,O.typeOfObject=i.TYPE.OBJECT,O.typeOfAction=i.TYPE.ACTION,O.unMapSub=f,O.unMapObj=h,O.unMapAct=g,O.deleteSub=v,O.deleteObj=y,O.deleteAct=j,O.getSubjects=b,O.getObjects=S,O.getActions=$,O.getCategoryFromData=p,s();var M={"event:deleteDataFromDataAddSuccess":t.$on("event:deleteDataFromDataAddSuccess",C)};for(var A in M)e.$on("$destroy",M[A])}angular.module("moon").directive("moonDataList",e),e.$inject=[],angular.module("moon").controller("moonDataListController",t),t.$inject=["$scope","$rootScope","dataService","$translate","alertService","policyService","DATA_CST","utilService","metaDataService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/parameter/perimeter/perimeter-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{policy:"=",editMode:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a,i,c){function l(){s(),u(),d()}function s(){T.loadingSub=!0,o.subject.findAllFromPolicyWithCallback(T.policy.id,function(e){T.subjects=e,T.loadingSub=!1})}function u(){T.loadingObj=!0,o.object.findAllFromPolicyWithCallback(T.policy.id,function(e){console.log("objects"),console.log(e),T.objects=e,T.loadingObj=!1})}function d(){T.loadingAct=!0,o.action.findAllFromPolicyWithCallback(T.policy.id,function(e){console.log("actions"),console.log(e),T.actions=e,T.loadingAct=!1})}function m(e){function t(t){n("moon.policy.metarules.update.success",{policyName:T.policy.name}).then(function(e){r.alertSuccess(e)}),T.policy=a.findPerimeterFromPolicy(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:T.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(T.policy);i.subject_categories=_.without(i.subject_categories,e.id),a.update(i,t,o)}function p(e){function t(t){n("moon.policy.metarules.update.success",{policyName:T.policy.name}).then(function(e){r.alertSuccess(e)}),T.policy=a.findPerimeterFromPolicy(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:T.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(T.policy);i.object_categories=_.without(i.object_categories,e.id),a.update(i,t,o)}function f(e){function t(t){n("moon.policy.metarules.update.success",{policyName:T.policy.name}).then(function(e){r.alertSuccess(e)}),T.policy=a.findPerimeterFromPolicy(c.transformOne(t,"meta_rules")),l(),e.loader=!1}function o(t){n("moon.policy.metarules.update.error",{policyName:T.policy.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0;var i=angular.copy(T.policy);i.action_categories=_.without(i.action_categories,e.id),a.update(i,t,o)}function h(e){function t(t){n("moon.policy.perimeter.subject.delete.success",{subjectName:e.name}).then(function(e){r.alertSuccess(e)}),S(e),e.loader=!1}function a(t){n("moon.policy.perimeter.subject.delete.error",{subjectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.subject.delete(e,t,a)}function g(e){function t(t){n("moon.policy.perimeter.object.delete.success",{objectName:e.name}).then(function(e){r.alertSuccess(e)}),$(e),e.loader=!1}function a(t){n("moon.policy.perimeter.object.delete.error",{objectName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.object.delete(e,t,a)}function v(e){function t(t){n("moon.policy.perimeter.action.delete.success",{actionName:e.name}).then(function(e){r.alertSuccess(e)}),E(e),e.loader=!1}function a(t){n("moon.policy.perimeter.action.delete.error",{actionName:e.name,reason:t.message}).then(function(e){r.alertError(e)}),e.loader=!1}e.loader=!0,o.action.delete(e,t,a)}function y(){return T.subjects?T.subjects:[]}function j(){return T.objects?T.objects:[]}function b(){return T.actions?T.actions:[]}function S(e){T.subjects=_.without(T.subjects,e)}function $(e){T.objects=_.without(T.objects,e)}function E(e){T.actions=_.without(T.actions,e)}function P(e,t){T.policy=t,l()}var T=this;T.policy=e.list.policy,T.editMode=e.list.editMode,T.typeOfSubject=i.TYPE.SUBJECT,T.typeOfObject=i.TYPE.OBJECT,T.typeOfAction=i.TYPE.ACTION,T.unMapSub=m,T.unMapObj=p,T.unMapAct=f,T.deleteSub=h,T.deleteObj=g,T.deleteAct=v,T.getSubjects=y,T.getObjects=j,T.getActions=b,l();var C={"event:deletePerimeterFromPerimeterAddSuccess":t.$on("event:deletePerimeterFromPerimeterAddSuccess",P)};for(var O in C)e.$on("$destroy",C[O])}angular.module("moon").directive("moonPerimeterList",e),e.$inject=[],angular.module("moon").controller("moonPerimeterListController",t),t.$inject=["$scope","$rootScope","perimeterService","$translate","alertService","policyService","PERIMETER_CST","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/policy/edit/parameter/rules/rules-list.tpl.html",bindToController:!0,controller:t,controllerAs:"list",scope:{policy:"=",editMode:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r){function a(){n.findAllFromPolicyWithCallback(h.policy.id,function(e){console.log("rules"),console.log(e),h.rules=e,h.loadingRules=!1,f()})}function i(){return h.table=new e({page:1,count:10,sorting:{name:"asc"}},{total:function(){return h.getRules().length},getData:function(e,o){var n=o.sorting()?t("orderBy")(h.getRules(),o.orderBy()):h.getRules();e.resolve(n.slice((o.page()-1)*o.count(),o.page()*o.count()))},$scope:{$data:{}}}),h.table}function c(e){return _.has(e,"meta_rule")?e.meta_rule:(_.has(e,"callMetaRuleInProgress")||(e.callMetaRuleInProgress=!0,o.findOneWithCallback(e.meta_rule_id,function(t){e.callMetaRuleInProgress=!1,e.meta_rule=t})),!1)}function l(e,t){if(_.has(t,"rule_value")||(t.rule_value=Array.apply(null,new Array(t.rule.length)).map(function(){return{category:{}}})),_.has(t.rule_value[e],"callCategoryInProgress")&&!t.rule_value[e].callCategoryInProgress)return t.rule_value[e].category;if(!_.has(t.rule_value[e],"callCategoryInProgress")){t.rule_value[e].callCategoryInProgress=!0;var o=0;h.isRuleIndexSubjectCategory(e,t)?(o=t.meta_rule.subject_categories[e],r.subject.data.findOne(h.policy.id,o,t.rule[e],function(o){t.rule_value[e].callCategoryInProgress=!1,t.rule_value[e].category=o})):h.isRuleIndexObjectCategory(e,t)?(o=t.meta_rule.object_categories[e-t.meta_rule.subject_categories.length],r.object.data.findOne(h.policy.id,o,t.rule[e],function(o){t.rule_value[e].callCategoryInProgress=!1,t.rule_value[e].category=o})):h.isRuleIndexActionCategory(e,t)?(o=t.meta_rule.action_categories[e-t.meta_rule.subject_categories.length-t.meta_rule.object_categories.length],r.action.data.findOne(h.policy.id,o,t.rule[e],function(o){t.rule_value[e].callCategoryInProgress=!1,t.rule_value[e].category=o})):(t.rule_value[e].callCategoryInProgress=!1,t.rule_value[e].category={name:"ERROR"})}return!1}function s(e,t){return e+1<=t.meta_rule.subject_categories.length}function u(e,t){var o=e+1;return t.meta_rule.subject_categories.length<o&&o<=t.meta_rule.object_categories.length+t.meta_rule.subject_categories.length}function d(e,t){var o=e+1;return t.meta_rule.object_categories.length+t.meta_rule.subject_categories.length<o&&o<=t.meta_rule.object_categories.length+t.meta_rule.subject_categories.length+t.meta_rule.action_categories.length}function m(){return h.rules?h.rules:[]}function p(){return h.getRules().length>0}function f(){h.table.total(h.rules.length),h.table.reload()}var h=this;h.rules=[],h.loadingRules=!0,h.table={},h.getRules=m,h.hasRules=p,h.refreshRules=f,h.getMetaRuleFromRule=c,h.getCategoryFromRuleIndex=l,h.isRuleIndexSubjectCategory=s,h.isRuleIndexObjectCategory=u,h.isRuleIndexActionCategory=d,function(){i(),a()}()}angular.module("moon").directive("moonRulesList",e),e.$inject=[],angular.module("moon").controller("moonRulesListController",t),t.$inject=["NgTableParams","$filter","metaRuleService","ruleService","dataService"]}(),function(){"use strict";function e(e,t,o){var n={subject:{policy:e(t.POLICIES+":policy_id/subject_assignments/:subject_id",{},{get:{method:"GET"},create:{method:"POST"},remove:{method:"DELETE"}})},object:{policy:e(t.POLICIES+":policy_id/object_assignments/:object_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})},action:{policy:e(t.POLICIES+":policy_id/action_assignments/:action_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})}};return{subject:{findAllFromPolicyWithCallback:function(e,t){n.subject.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e,"subject_assignments"))})}},object:{findAllFromPolicyWithCallback:function(e,t){n.object.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e,"object_assignments"))})}},action:{findAllFromPolicyWithCallback:function(e,t){n.action.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e,"action_assignments"))})}}}}angular.module("moon").factory("assignmentService",e),e.$inject=["$resource","REST_URI","utilService"]}(),function(){"use strict";function e(e,t,o){var n={subject:{policy:e(t.POLICIES+":policy_id/subject_data/:subject_id/:data_id",{},{get:{method:"GET"},create:{method:"POST"},remove:{method:"DELETE"}})},object:{policy:e(t.POLICIES+":policy_id/object_data/:object_id/:data_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})},action:{policy:e(t.POLICIES+":policy_id/action_data/:action_id/:data_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})}};return{subject:{findAllFromPolicyWithCallback:function(e,t){n.subject.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e.subject_data[0],"data"))})},delete:function(e,t,o){n.subject.perimeter.remove({subject_id:e.id},e,t,o)},add:function(e,t,o){n.subject.perimeter.create({},e,t,o)},data:{findOne:function(e,t,r,a){n.subject.policy.get({policy_id:e,subject_id:t,data_id:r}).$promise.then(function(e){a(e.subject_data[0]?o.transformOne(e.subject_data[0],"data"):{})})}}},object:{findAllFromPolicyWithCallback:function(e,t){n.object.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e.object_data[0],"data"))})},delete:function(e,t,o){n.object.perimeter.remove({object_id:e.id},e,t,o)},add:function(e,t,o){n.object.perimeter.create({},e,t,o)},data:{findOne:function(e,t,r,a){n.object.policy.get({policy_id:e,object_id:t,data_id:r}).$promise.then(function(e){a(e.object_data[0]?o.transformOne(e.object_data[0],"data"):{})})}}},action:{findAllFromPolicyWithCallback:function(e,t){n.action.policy.get({policy_id:e}).$promise.then(function(e){t(o.transform(e.action_data[0],"data"))})},delete:function(e,t,o){n.action.perimeter.remove({action_id:e.id},e,t,o)},add:function(e,t,o){n.action.perimeter.create({},e,t,o)},data:{findOne:function(e,t,r,a){n.action.policy.get({policy_id:e,action_id:t,data_id:r}).$promise.then(function(e){a(e.action_data[0]?o.transformOne(e.action_data[0],"data"):{})})}}}}}angular.module("moon").factory("dataService",e),e.$inject=["$resource","REST_URI","utilService"]}(),function(){"use strict";function e(e,t,o,n){var r={subject:{perimeter:e(t.PERIMETERS.subject+":subject_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}}),policy:e(t.POLICIES+":policy_id/subjects/:subject_id",{},{get:{method:"GET"},create:{method:"POST"},remove:{method:"DELETE"}})},object:{perimeter:e(t.PERIMETERS.object+":object_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}}),policy:e(t.POLICIES+":policy_id/objects/:object_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})},action:{perimeter:e(t.PERIMETERS.action+":action_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}}),policy:e(t.POLICIES+":policy_id/actions/:action_id",{},{get:{method:"GET",isArray:!1},create:{method:"POST"},remove:{method:"DELETE"}})}};return{subject:{findOne:function(e,t){r.subject.perimeter.get({subject_id:e}).$promise.then(function(e){t(n.transformOne(e,"subjects"))})},findOneReturningPromise:function(e){return r.subject.perimeter.get({subject_id:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"subjects")})})},findAllFromPolicyWithCallback:function(e,t){r.subject.policy.get({policy_id:e}).$promise.then(function(e){t(n.transform(e,"subjects"))})},findOneFromPolicyWithCallback:function(e,t,o){r.subject.policy.get({policy_id:e,subject_id:t}).$promise.then(function(e){o(n.transformOne(e,"subjects"))})},findAll:function(){return r.subject.perimeter.get().$promise.then(function(e){return n.transform(e,"subjects")})},findAllWithCallback:function(e){return r.subject.perimeter.get().$promise.then(function(t){e(n.transform(t,"subjects"))})},delete:function(e,t,o){r.subject.perimeter.remove({subject_id:e.id},e,t,o)},add:function(e,t,o){r.subject.perimeter.create({},e,t,o)}},object:{findOne:function(e,t){r.object.perimeter.get({object_id:e}).$promise.then(function(e){t(n.transformOne(e,"objects"))})},findOneReturningPromise:function(e){return r.object.perimeter.get({object_id:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"objects")})})},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});o.all(a).then(function(e){t(_(e).map(function(e){return n.transformOne(e,"objects")}))})},findAll:function(){return r.object.perimeter.get().$promise.then(function(e){return n.transform(e,"objects")})},findAllFromPolicyWithCallback:function(e,t){r.object.policy.get({policy_id:e}).$promise.then(function(e){t(n.transform(e,"objects"))})},findOneFromPolicyWithCallback:function(e,t,o){r.object.policy.get({policy_id:e,object_id:t}).$promise.then(function(e){o(n.transformOne(e,"objects"))})},findAllWithCallback:function(e){return r.object.perimeter.get().$promise.then(function(t){e(n.transform(t,"objects"))})},delete:function(e,t,o){r.object.perimeter.remove({object_id:e.id},e,t,o)},add:function(e,t,o){r.object.perimeter.create({},e,t,o)}},action:{findOne:function(e,t){r.action.perimeter.get({actionId:e}).$promise.then(function(e){t(n.transformOne(e,"actions"))})},findOneReturningPromise:function(e){return r.action.perimeter.get({actionId:e}).$promise},findSome:function(e){var t=this;if(0===e.length)return[];var r=_(e).map(function(e){return t.findOneReturningPromise(e)});return o.all(r).then(function(e){return _(e).map(function(e){return n.transformOne(e,"actions")})})},findSomeWithCallback:function(e,t){var r=this;0===e.length&&t([]);var a=_(e).map(function(e){return r.findOneReturningPromise(e)});o.all(a).then(function(e){t(_(e).map(function(e){return n.transformOne(e,"actions")}))})},findAll:function(){return r.action.perimeter.get().$promise.then(function(e){return n.transform(e,"actions")})},findAllFromPolicyWithCallback:function(e,t){r.action.policy.get({policy_id:e}).$promise.then(function(e){t(n.transform(e,"actions"))})},findOneFromPolicyWithCallback:function(e,t,o){r.action.policy.get({policy_id:e,action_id:t}).$promise.then(function(e){o(n.transformOne(e,"actions"))})},findAllWithCallback:function(e){return r.action.perimeter.get().$promise.then(function(t){e(n.transform(t,"actions"))})},delete:function(e,t,o){r.action.perimeter.remove({action_id:e.id},e,t,o)},add:function(e,t,o){r.action.perimeter.create({},e,t,o)}}}}angular.module("moon").factory("perimeterService",e),e.$inject=["$resource","REST_URI","$q","utilService"]}(),function(){"use strict";function e(e,t,o){return{data:{policy:e(t.POLICIES+":policy_id/rules/:rule_id",{},{get:{method:"GET"},create:{method:"POST"},remove:{method:"DELETE"}})},findAllFromPolicyWithCallback:function(e,t){this.data.policy.get({policy_id:e}).$promise.then(function(e){console.log("ruleService - findAllFromPolicyWithCallback()"),console.log(e);var n=e.rules;console.log(JSON.stringify(n)),t(o.transform(n,"rules"))})}}}angular.module("moon").factory("ruleService",e),e.$inject=["$resource","REST_URI","utilService"]}(),function(){"use strict";function e(){return{templateUrl:"html/model/edit/metarules/action/mapping/metarules-add.tpl.html",bindToController:!0,controller:t,controllerAs:"add",scope:{metaRules:"="},restrict:"E",replace:!0}}function t(e,t,o,n,r,a){function i(){function i(t){var r=a.transformOne(t,"meta_rules");n("moon.model.metarules.add.success",{metaRuleName:r.name}).then(function(e){o.alertSuccess(e)}),c.loading=!1,e.$emit("event:metaRuleCreatedSuccess",r)}function l(t){n("moon.model.metarules.add.error",{metaRuleName:c.metaRule.name}).then(function(e){o.alertError(e)}),c.loading=!1,e.$emit("event:metaRuleCreatedError",c.project)}r.isInvalid(c.form)?r.checkFieldsValidity(c.form):(c.loading=!0,t.data.create({},c.metaRule,i,l))}var c=this;c.laoading=!1,c.form={},c.metaRule={name:null,description:null,subject_categories:[],object_categories:[],action_categories:[]},c.create=i}angular.module("moon").directive("moonMetaRulesAdd",e),e.$inject=[],angular.module("moon").controller("moonMetaRulesAddController",t),t.$inject=["$scope","metaRuleService","alertService","$translate","formService","utilService"]}(),function(){"use strict";function e(e,t,o,n,r,a,i,c){function l(){h.metaRulesLoading=!0,a.findAllWithCallback(function(e){h.metaRules=e,h.metaRulesLoading=!1})}function s(){function t(t){var r=c.transformOne(t,"models");a.findSomeWithMetaData(r.meta_rules).then(function(t){r.meta_rules_values=t,n("moon.model.metarules.map.success",{modelName:r.name,metaRuleName:h.selectedMetaRule.name}).then(function(e){o.alertSuccess(e)}),h.mappingLoading=!1,e.$emit("event:metaRuleMapToModelSuccess",r)})}function l(e){n("moon.model.metarules.map.error",{modelName:h.model.name,metaRuleName:h.selectedMetaRule.name}).then(function(e){o.alertError(e)}),h.mappingLoading=!1}if(r.isInvalid(h.form))r.checkFieldsValidity(h.form);else{h.mappingLoading=!0;var s=angular.copy(h.model);s.meta_rules.push(h.selectedMetaRule.id),i.update(s,t,l)}}function u(){delete h.selectedMetaRule}function d(){function t(t){n("moon.model.metarules.delete.success",{metaRuleName:i.name}).then(function(e){o.alertSuccess(e)}),u(),h.mappingLoading=!1,l(),e.$emit("event:deleteMetaRule",i)}function r(e){n("moon.model.metarules.delete.error",{metaRuleName:i.name}).then(function(e){o.alertError(e)}),h.mappingLoading=!1}if(h.selectedMetaRule){h.mappingLoading=!0;var i=angular.copy(h.selectedMetaRule);a.delete(i,t,r)}}function m(e,t){h.metaRules.push(t),f()}function p(e){}function f(){h.addMetaRuleToList=!1}var h=this;h.metaRules=[],h.model=e.model,h.addMetaRuleToList=!1,h.mapToModel=s,h.deleteMetaRule=d,function(){l()}();var g={"event:metaRuleCreatedSuccess":t.$on("event:metaRuleCreatedSuccess",m),"event:metaRuleCreatedError":t.$on("event:metaRuleCreatedError",p)};for(var v in g)e.$on("$destroy",g[v])}angular.module("moon").controller("moonMetaRulesMapController",e),e.$inject=["$scope","$rootScope","alertService","$translate","formService","metaRuleService","modelService","utilService"]}(),function(){"use strict";function e(e,t,o,n){function r(){function r(n){t("moon.model.metarules.unmap.success",{modelName:a.model.name,metaRuleName:a.metaRule.name}).then(function(e){o.alertSuccess(e)}),a.unMappingLoading=!1,e.$emit("event:metaRuleUnMappedToModelSuccess",c)}function i(n){t("moon.model.metarules.unmap.error",{modelName:a.model.name,metaRuleName:a.metaRule.name}).then(function(e){o.alertError(e)}),a.unMappingLoading=!1,e.$emit("event:metaRuleUnMappedToModelError")}a.unMappingLoading=!0;var c=angular.copy(a.model);c.meta_rules=_.without(c.meta_rules,a.metaRule.id),n.update(c,r,i)}var a=this;a.model=e.model,a.metaRule=e.metaRule,a.unMappingLoading=!1,a.unmap=r}angular.module("moon").controller("MetaRulesUnMapController",e),e.$inject=["$scope","$translate","alertService","modelService"]}();
\ No newline at end of file |