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.

82 lines
2.0 KiB

  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright (C) 2017 Marcos Pereira <marcospereira.mpj@gmail.com>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Lesser General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. class Permission:
  18. def __init__(self, name, type, logic, decision_strategy):
  19. self._name = name
  20. self._type = type
  21. self._logic = logic
  22. self._decision_strategy = decision_strategy
  23. self._resources = []
  24. self._scopes = []
  25. def __repr__(self):
  26. return "<Permission: %s (%s)>" % (self.name, self.type)
  27. def __str__(self):
  28. return "Permission: %s (%s)" % (self.name, self.type)
  29. @property
  30. def name(self):
  31. return self._name
  32. @name.setter
  33. def name(self, value):
  34. self._name = value
  35. @property
  36. def type(self):
  37. return self._type
  38. @type.setter
  39. def type(self, value):
  40. self._type = value
  41. @property
  42. def logic(self):
  43. return self._logic
  44. @logic.setter
  45. def logic(self, value):
  46. self._logic = value
  47. @property
  48. def decision_strategy(self):
  49. return self._decision_strategy
  50. @decision_strategy.setter
  51. def decision_strategy(self, value):
  52. self._decision_strategy = value
  53. @property
  54. def resources(self):
  55. return self._resources
  56. @resources.setter
  57. def resources(self, value):
  58. self._resources = value
  59. @property
  60. def scopes(self):
  61. return self._scopes
  62. @scopes.setter
  63. def scopes(self, value):
  64. self._scopes = value