电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.6 KiB

  1. /* Licensed under the Apache License, Version 2.0 (the "License");
  2. * you may not use this file except in compliance with the License.
  3. * You may obtain a copy of the License at
  4. *
  5. * http://www.apache.org/licenses/LICENSE-2.0
  6. *
  7. * Unless required by applicable law or agreed to in writing, software
  8. * distributed under the License is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. * See the License for the specific language governing permissions and
  11. * limitations under the License.
  12. */
  13. 'use strict';
  14. angular.module('flowableModeler').service('UserService', ['$http', '$q',
  15. function ($http, $q) {
  16. var httpAsPromise = function(options) {
  17. var deferred = $q.defer();
  18. $http(options).
  19. success(function (response, status, headers, config) {
  20. deferred.resolve(response);
  21. })
  22. .error(function (response, status, headers, config) {
  23. deferred.reject(response);
  24. });
  25. return deferred.promise;
  26. };
  27. /*
  28. * Filter users based on a filter text.
  29. */
  30. this.getFilteredUsers = function (filterText, taskId, processInstanceId) {
  31. var params = {filter: filterText};
  32. if(taskId) {
  33. params.excludeTaskId = taskId;
  34. }
  35. if (processInstanceId) {
  36. params.exclusdeProcessId = processInstanceId;
  37. }
  38. return httpAsPromise({
  39. method: 'GET',
  40. url: FLOWABLE.APP_URL.getEditorUsersUrl(),
  41. params: params
  42. });
  43. };
  44. }]);
  45. angular.module('flowableModeler').service('GroupService', ['$http', '$q',
  46. function ($http, $q) {
  47. var httpAsPromise = function(options) {
  48. var deferred = $q.defer();
  49. $http(options).
  50. success(function (response, status, headers, config) {
  51. deferred.resolve(response);
  52. })
  53. .error(function (response, status, headers, config) {
  54. deferred.reject(response);
  55. });
  56. return deferred.promise;
  57. };
  58. /*
  59. * Filter functional groups based on a filter text.
  60. */
  61. this.getFilteredGroups = function (filterText) {
  62. var params;
  63. if(filterText) {
  64. params = {filter: filterText};
  65. }
  66. return httpAsPromise({
  67. method: 'GET',
  68. url: FLOWABLE.APP_URL.getEditorGroupsUrl(),
  69. params: params
  70. });
  71. };
  72. }]);