Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

groupedit.controller.js 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Created by robin on 11/4/15.
  3. */
  4. angular.module('luticate')
  5. .controller('GroupEditController', ['$scope', 'luticateAuthGroups', 'data', 'dialogs', '$q', 'luticateAuthCache',
  6. function($scope, luticateAuthGroups, data, dialogs, $q, luticateAuthCache) {
  7. if (data != null) {
  8. $scope.group = data;
  9. $scope.permission = "LU_GROUP_EDIT";
  10. }
  11. else {
  12. $scope.group = {
  13. Name: ""
  14. };
  15. $scope.permission = "LU_GROUP_ADD";
  16. }
  17. $scope.submitForm = function()
  18. {
  19. if (luticateAuthCache.hasEffectivePermission($scope.permission)) {
  20. if ($scope.group.Id != null) {
  21. var promiseEditGroup = {
  22. id: "promiseEditGroup",
  23. loaderGroups: ["modal"]
  24. };
  25. return luticateAuthGroups.edit({
  26. group_id: $scope.group.Id,
  27. group_name: $scope.group.Name
  28. }, promiseEditGroup);
  29. }
  30. else {
  31. var promiseAddGroup = {
  32. id: "promiseAddGroup",
  33. loaderGroups: ["modal"]
  34. };
  35. return luticateAuthGroups.add({
  36. group_name: $scope.group.Name
  37. }, promiseAddGroup);
  38. }
  39. }
  40. else {
  41. var defer = $q.defer();
  42. defer.resolve();
  43. return defer.promise;
  44. }
  45. };
  46. $scope.canEditUsers = function()
  47. {
  48. return $scope.group.Id != null &&
  49. (luticateAuthCache.hasEffectivePermission('LU_GROUP_USER_DEL') ||
  50. luticateAuthCache.hasAllEffectivePermissions(['LU_GROUP_USER_ADD', 'LU_USER_GET']));
  51. };
  52. $scope.canEditPermissions = function()
  53. {
  54. return $scope.group.Id != null && luticateAuthCache.hasEffectivePermission('LU_PERM_GROUP_GET');
  55. };
  56. $scope.editPermissions = function(group)
  57. {
  58. dialogs.create('views/modals/grouppermissions.html', 'GroupPermissionsController', group);
  59. };
  60. $scope.editUsers = function(group)
  61. {
  62. dialogs.create('views/modals/groupusers.html', 'GroupUsersController', group);
  63. };
  64. }]);