2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 app.factory('AdminService', function ($http, $q) {
22 getRoles: function() {
23 return $http.get('get_roles')
24 .then(function(response) {
25 if (typeof response.data === 'object') {
28 return $q.reject(response.data);
31 }, function(response) {
32 // something went wrong
33 return $q.reject(response.data);
37 getRoleFunctionList: function() {
38 return $http.get('get_role_functions')
39 .then(function(response) {
40 if (typeof response.data === 'object') {
43 return $q.reject(response.data);
46 }, function(response) {
47 // something went wrong
48 return $q.reject(response.data);
52 getFnMenuItems: function(){
54 return $http.get('admin_fn_menu')
55 .then(function(response) {
56 if (typeof response.data === 'object') {
60 return $q.reject(response.data);
63 }, function(response) {
64 // something went wrong
65 return $q.reject(response.data);
69 getCacheRegions: function() {
70 return $http.get('get_regions')
71 .then(function(response) {
72 if (typeof response.data === 'object') {
75 return $q.reject(response.data);
78 }, function(response) {
79 // something went wrong
80 return $q.reject(response.data);
84 getUsageList: function() {
85 return $http.get('get_usage_list')
86 .then(function(response) {
87 if (typeof response.data === 'object') {
90 return $q.reject(response.data);
93 }, function(response) {
94 // something went wrong
95 return $q.reject(response.data);
99 getBroadcastList: function() {
100 return $http.get('get_broadcast_list')
101 .then(function(response) {
102 if (typeof response.data === 'object') {
103 return response.data;
105 return $q.reject(response.data);
108 }, function(response) {
109 // something went wrong
110 return $q.reject(response.data);
114 getBroadcast: function(messageLocationId, messageLocation, messageId) {
115 return $http.get('get_broadcast?message_location_id='+messageLocationId + '&message_location=' + messageLocation + ((messageId != null) ? '&message_id=' + messageId : ''))
116 .then(function(response) {
117 if (typeof response.data === 'object') {
118 return response.data;
120 return $q.reject(response.data);
123 }, function(response) {
124 // something went wrong
125 return $q.reject(response.data);
129 getCollaborateList: function() {
130 return $http.get('get_collaborate_list')
131 .then(function(response) {
132 if (typeof response.data === 'object') {
133 return response.data;
135 return $q.reject(response.data);
138 }, function(response) {
139 // something went wrong
140 return $q.reject(response.data);
144 getRole: function(roleId) {
146 return $http.get('get_role?role_id=' + roleId)
147 .then(function(response) {
148 if (typeof response.data === 'object') {
149 return response.data;
151 return $q.reject(response.data);
154 }, function(response) {
155 // something went wrong
156 return $q.reject(response.data);