aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2019-03-11 13:47:22 +0100
committerxg353y <xg353y@intl.att.com>2019-03-11 14:25:19 +0100
commita9be95f91ea469681517c697fae2fd2a5bcd9ff5 (patch)
tree7487bdd874dd9e2e5f21e9eea64b4a16eacc6ec4 /src/main/resources
parent2f56e98490cd3f7f3a688685e38ee6178c19648c (diff)
Rework authorization controller
Rework the authorization controller, put the authorization code into a camel box, so that it could be put and remove from other methods easily and not tightly connected with other logic; Remove unused CldsTemplateService.js Issue-ID: CLAMP-305 Change-Id: I5e01f1fa4534e78e0996b4b8acaf33f1875e95f0 Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/META-INF/resources/designer/index.html1
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js12
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js67
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js3
-rw-r--r--src/main/resources/application-noaaf.properties2
-rw-r--r--src/main/resources/application.properties2
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml24
-rw-r--r--src/main/resources/clds/clds-users.json1
8 files changed, 21 insertions, 91 deletions
diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html
index e30d7245b..ec13e2a02 100644
--- a/src/main/resources/META-INF/resources/designer/index.html
+++ b/src/main/resources/META-INF/resources/designer/index.html
@@ -172,7 +172,6 @@
<script src="scripts/ExtraUserInfoCtrl.js"></script>
<script src="scripts/ExtraUserInfoService.js"></script>
<script src="scripts/saveConfirmationModalPopUpCtrl.js"></script>
- <script src="scripts/CldsTemplateService.js"></script>
<script src="scripts/GlobalPropertiesCtrl.js"></script>
<script src="scripts/AlertService.js"></script>
<script src="scripts/ToscaModelCtrl.js"></script>
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js
index a1625a936..0e3fce971 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js
@@ -32,9 +32,8 @@ app
'cldsModelService',
'$location',
'dialogs',
-'cldsTemplateService',
function($scope, $rootScope, $modalInstance, $window, $uibModalInstance, cldsModelService, $location,
- dialogs, cldsTemplateService) {
+ dialogs) {
$scope.typeModel = 'template';
$scope.error = {
flag : false,
@@ -67,15 +66,6 @@ function($scope, $rootScope, $modalInstance, $window, $uibModalInstance, cldsMod
$scope.close();
}
}
- cldsTemplateService.getSavedTemplate().then(function(pars) {
- $scope.templateNamel = []
- for (var i = 0; i < pars.length; i++) {
- $scope.templateNamel.push(pars[i].value);
- }
- setTimeout(function() {
- setMultiSelect();
- }, 100);
- });
function contains(a, obj) {
var i = a && a.length > 0 ? a.length : 0;
while (i--) {
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js
deleted file mode 100644
index 4a0e7147c..000000000
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsTemplateService.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-app.service('cldsTemplateService', ['alertService', '$http', '$q', function (alertService, $http, $q) {
- this.getTemplate = function(templateName){
-
-
- var def = $q.defer();
- var sets = [];
-
- var svcUrl = "/restservices/clds/v1/cldsTempate/template/" + templateName;
-
- $http.get(svcUrl)
- .success(function(data){
-
- def.resolve(data);
-
- })
- .error(function(data){
-
- def.reject("Open Model not successful");
- });
-
- return def.promise;
- };
- this.getSavedTemplate=function(){
-
- var def = $q.defer();
- var sets = [];
-
- var svcUrl = "/restservices/clds/v1/cldsTempate/template-names";
-
- $http.get(svcUrl)
- .success(function(data){
-
- def.resolve(data);
-
- })
- .error(function(data){
-
- def.reject("Open Model not successful");
- });
-
- return def.promise;
- };
-
- }]);
diff --git a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js
index 2ac959b45..e9ff49961 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js
@@ -27,9 +27,8 @@ app.controller('GlobalPropertiesCtrl', [
'cldsModelService',
'$location',
'dialogs',
-'cldsTemplateService',
function($scope, $rootScope, $uibModalInstance, cldsModelService, $location,
- dialogs, cldsTemplateService) {
+ dialogs) {
$scope.$watch('name', function(newValue, oldValue) {
var el = getGlobalProperty();
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 7dd0314a1..632856e92 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -208,7 +208,7 @@ clamp.config.dcae.header.requestId = X-ECOMP-RequestID
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
clamp.config.security.permission.type.cl=org.onap.clamp.clds.cl
clamp.config.security.permission.type.cl.manage=org.onap.clamp.clds.cl.manage
-clamp.config.security.permission.type.cl.event=org.onap.clds.cl.event
+clamp.config.security.permission.type.cl.event=org.onap.clamp.clds.cl.event
clamp.config.security.permission.type.filter.vf=org.onap.clamp.clds.filter.vf
clamp.config.security.permission.type.template=org.onap.clamp.clds.template
clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 8859c4b32..91c02ef74 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -223,7 +223,7 @@ clamp.config.dcae.header.requestId = X-ECOMP-RequestID
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
clamp.config.security.permission.type.cl=org.onap.clamp.clds.cl
clamp.config.security.permission.type.cl.manage=org.onap.clamp.clds.cl.manage
-clamp.config.security.permission.type.cl.event=org.onap.clds.cl.event
+clamp.config.security.permission.type.cl.event=org.onap.clamp.clds.cl.event
clamp.config.security.permission.type.filter.vf=org.onap.clamp.clds.filter.vf
clamp.config.security.permission.type.template=org.onap.clamp.clds.template
clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 0a72a0c12..0fd1250df 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -3,31 +3,39 @@
<get uri="/v2/loop/getAllNames"
outType="java.lang.String[]"
produces="application/json">
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
+ </route>
</get>
<get uri="/v2/loop/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ </route>
</get>
<post uri="/v2/loop/updateOperationalPolicies/{loopName}"
type="com.google.gson.JsonArray"
consumes="application/json"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${body})" />
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${body})" />
+ </route>
</post>
<post uri="/v2/loop/updateMicroservicePolicies/{loopName}"
type="com.google.gson.JsonArray"
consumes="application/json"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicies(${header.loopName},${body})" />
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicies(${header.loopName},${body})" />
+ </route>
</post>
</rest>
</rests>
diff --git a/src/main/resources/clds/clds-users.json b/src/main/resources/clds/clds-users.json
index b4d73a29f..fe305980b 100644
--- a/src/main/resources/clds/clds-users.json
+++ b/src/main/resources/clds/clds-users.json
@@ -6,6 +6,7 @@
"org.onap.clamp.clds.cl|dev|read",
"org.onap.clamp.clds.cl|dev|update",
"org.onap.clamp.clds.cl.manage|dev|*",
+ "org.onap.clamp.clds.cl.event|dev|*",
"org.onap.clamp.clds.filter.vf|dev|*",
"org.onap.clamp.clds.template|dev|read",
"org.onap.clamp.clds.template|dev|update",