2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
36 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
38 app.factory('RoleService', function ($http, $q, conf,uuid4) {
39 var manageRoleDetails = {};
42 return $http.get(conf.api.getRoles.replace(':appId', appId),{
45 'X-ECOMP-RequestID':uuid4.generate()
48 .then(function(response) {
49 if (typeof response.data === 'object') {
52 return $q.reject(response.data);
55 }, function(response) {
56 // something went wrong
57 return $q.reject(response.data);
61 saveRoleFunction(appId) {
62 return $http.post(conf.api.saveRoleFuncion.replace(':appId', appId))
63 .then(function(response) {
64 if (typeof response.data === 'object') {
67 return $q.reject(response.data);
70 }, function(response) {
71 // something went wrong
72 return $q.reject(response.data);
76 getRoleFunctionList(appId) {
77 return $http.get(conf.api.getRoleFunctions.replace(':appId', appId),{
80 'X-ECOMP-RequestID':uuid4.generate()
83 .then(function(response) {
84 if (typeof response.data === 'object') {
87 return $q.reject(response.data);
90 }, function(response) {
91 // something went wrong
92 return $q.reject(response.data);
96 getFnMenuItems: function(){
98 return $http.get('admin_fn_menu')
99 .then(function(response) {
100 if (typeof response.data === 'object') {
102 return response.data;
104 return $q.reject(response.data);
107 }, function(response) {
108 // something went wrong
109 return $q.reject(response.data);
113 getCacheRegions: function() {
114 return $http.get('get_regions')
115 .then(function(response) {
116 if (typeof response.data === 'object') {
117 return response.data;
119 return $q.reject(response.data);
122 }, function(response) {
123 // something went wrong
124 return $q.reject(response.data);
128 getUsageList: function() {
129 return $http.get('get_usage_list')
130 .then(function(response) {
131 if (typeof response.data === 'object') {
132 return response.data;
134 return $q.reject(response.data);
137 }, function(response) {
138 // something went wrong
139 return $q.reject(response.data);
143 getBroadcastList: function() {
144 return $http.get('get_broadcast_list')
145 .then(function(response) {
146 if (typeof response.data === 'object') {
147 return response.data;
149 return $q.reject(response.data);
152 }, function(response) {
153 // something went wrong
154 return $q.reject(response.data);
158 getBroadcast: function(messageLocationId, messageLocation, messageId) {
159 return $http.get('get_broadcast?message_location_id='+messageLocationId + '&message_location=' + messageLocation + ((messageId != null) ? '&message_id=' + messageId : ''))
160 .then(function(response) {
161 if (typeof response.data === 'object') {
162 return response.data;
164 return $q.reject(response.data);
167 }, function(response) {
168 // something went wrong
169 return $q.reject(response.data);
173 getCollaborateList: function() {
174 return $http.get('get_collaborate_list')
175 .then(function(response) {
176 if (typeof response.data === 'object') {
177 return response.data;
179 return $q.reject(response.data);
182 }, function(response) {
183 // something went wrong
184 return $q.reject(response.data);
188 getRole: function(appId, roleId) {
190 return $http.get(conf.api.getRole + '/' + appId + '/' + roleId,{
193 'X-ECOMP-RequestID':uuid4.generate()
196 .then(function(response) {
197 if (typeof response.data === 'object') {
198 return response.data;
200 return $q.reject(response.data);
203 }, function(response) {
204 // something went wrong
205 return $q.reject(response.data);
210 return $http.post(conf.api.saveRole.replace(':appId', appId))
211 .then(function(response) {
212 if (typeof response.data === 'object') {
213 return response.data;
215 return $q.reject(response.data);
218 }, function(response) {
219 // something went wrong
220 return $q.reject(response.data);
224 getCentralizedApps: function(userId) {
226 return $http.get(conf.api.centralizedApps + '?userId=' + userId,{
229 'X-ECOMP-RequestID':uuid4.generate()
232 .then(function(response) {
233 if (typeof response.data === 'object') {
234 return response.data;
236 return $q.reject(response.data);
239 }, function(response) {
240 // something went wrong
241 return $q.reject(response.data);
245 setManageRoleDetails:function(apps, id){
246 manageRoleDetails = {
252 getManageRoleDetails: function(){
253 return manageRoleDetails;