role.svc.js 5.34 KB
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
// web service proxy for role
webservices.factory('roleService', ['$http', 'apiConfig', function ($http, apiConfig) {
    'use strict';
    return {
        getRoleListByServiceGroup: function () {
            return $http.get('/role/displayByServiceGroup', apiConfig.create());
        },
        getUsersByRoleID: function (roleId) {
            return $http.get('/role/getUsersByRoleID?roleId=' + roleId, apiConfig.create());
        },
        getExtraUsersByRoleID: function (roleId) {
            return $http.get('/role/getExtraUsersByRoleID?roleId=' + roleId, apiConfig.create());
        },
        getRoleListByRoleTypeId: function (roleTypeId) {
            return $http.get('/role/displayByRoleType?roleTypeId=' + roleTypeId, apiConfig.create());
        },
        getSingleRole: function (roleId) {
            return $http.get('/role/displaySingle?roleId=' + roleId, apiConfig.create());
        },
        addRole: function (role) {
            return $http.post('/role/add', role, apiConfig.create());
        },
        updateRole: function (updateRole, roleId) {
            return $http.put('/role/update?roleID=' + roleId, updateRole, apiConfig.create());
        },
        deleteRole: function (role) {
            return $http.post('/role/delete', role, apiConfig.create());
        },
        deleteRoles: function (roleList) {
            return $http.post('/role/deleteRoleList', { roleList: roleList }, apiConfig.create());
        },
        checkRoleExist: function (roleId) {
            return $http.get('/role/exist?roleId=' + roleId, apiConfig.create());
        },

        checkReference: function (roleID) {
            return $http.get('/role/checkReferenceforRole?roleID=' + roleID, apiConfig.create());
        },
        getroletree: function (serviceTypeID) {
            return $http.get('/role/getroletree?serviceTypeID=' + serviceTypeID, apiConfig.create());
        },
        getRoleTreeList: function () {
            return $http.get('/role/getRoleTreeList', apiConfig.create());
        },
45 46
        getUserRoleList: function (organizationID, dimensionID, dimensionValueID) {
            return $http.get('/role/getUserRoleList?organizationID=' + organizationID + '&dimensionID=' + dimensionID + '&dimensionValueID=' + dimensionValueID, apiConfig.create());
eddie.woo's avatar
eddie.woo committed
47 48 49 50 51 52 53 54
        },
        getAllUserRoleList: function () {
            return $http.get('/role/getAllUserRoleList', apiConfig.create());
        },
        getAllUserRoleListByUserID: function (userID) {
            return $http.get('/role/getAllUserRoleListByUserID?userID=' + userID, apiConfig.create());
        },
        //用户下面多个角色,多少个机构
55 56
        getDimensionUserRoleList: function (dimensionID, dimensionValueID) {
            return $http.get('/role/getDimensionUserRoleList?dimensionID=' + dimensionID + '&dimensionValueID=' + dimensionValueID, apiConfig.create());
eddie.woo's avatar
eddie.woo committed
57
        },
58 59
        getDimensionRoleUserList: function (dimensionID, dimensionValueID) {
            return $http.get('/role/getDimensionRoleUserList?dimensionID=' + dimensionID + '&dimensionValueID=' + dimensionValueID, apiConfig.create());
eddie.woo's avatar
eddie.woo committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
        },
        getAllOwnUserRoleList: function () {
            return $http.get('/role/getAllOwnUserRoleList', apiConfig.create());
        },
        removeUserRole: function (userID, roleIDList, serviceTypeID) {
            return $http.post('/role/removeUserRole?userID=' + userID + '&serviceTypeID=' + serviceTypeID, roleIDList, apiConfig.create());
        },
        getAllRoleListByUserID: function (userID, serviceTypeID) {
            return $http.get('/role/getAllRoleListByUserID?userID=' + userID + '&serviceTypeID=' + serviceTypeID, apiConfig.create());
        },
        updateUserRole: function (userRoleUpdteModel) {
            return $http.post('/role/updateUserRole', userRoleUpdteModel, apiConfig.create());
        },
        updateDimensionValues: function (dimensionValueModel) {
            return $http.post('/role/updateDimensionValues', dimensionValueModel, apiConfig.create());
        },
        updateUserOrg: function (orgIdList, userID) {
            return $http.post('/role/updateUserOrg?userID=' + userID, orgIdList, apiConfig.create());
        },
        validateRoleNameUnique: function (roleName, oldRoleName) {
            return $http.get('/role/validateRoleNameUnique?roleName=' + roleName + '&oldRoleName=' + oldRoleName, apiConfig.create({ ignoreLoadingBar: true }));
        },
        addRoleCategory: function (name, roleCategoryID) {
            return $http.get('/role/addRoleCategory?name=' + encodeURI(name) + '&roleCategoryID=' + roleCategoryID, apiConfig.create({ ignoreLoadingBar: false }));
        },
        updateRoleCategory: function (updateName, id) {
            return $http.get('/role/updateRoleCategory?updateName=' + encodeURI(updateName) + '&id=' + id, apiConfig.create({ ignoreLoadingBar: false }));
        },
        deleteRoleCategory: function (id) {
            return $http.get('/role/deleteRoleCategory?id=' + id, apiConfig.create({ ignoreLoadingBar: false }));
        },
        getAllRolePermission: function (serviceTypeID) {
            return $http.get('/role/getAllRolePermission?serviceTypeID=' + serviceTypeID, apiConfig.create());
        },
        getActiveUserRoleListByAreaID: function (areaId) {
            return $http.get('/role/getActiveUserRoleListByAreaID?areaID=' + areaId, apiConfig.create());
        }
    };
}]);