1
0

ICheck.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\WorkflowEngine;
  7. /**
  8. * Interface ICheck
  9. *
  10. * @since 9.1
  11. */
  12. interface ICheck {
  13. /**
  14. * @param string $operator
  15. * @param string $value
  16. * @return bool
  17. * @since 9.1
  18. */
  19. public function executeCheck($operator, $value);
  20. /**
  21. * @param string $operator
  22. * @param string $value
  23. * @throws \UnexpectedValueException
  24. * @since 9.1
  25. */
  26. public function validateCheck($operator, $value);
  27. /**
  28. * returns a list of Entities the checker supports. The values must match
  29. * the class name of the entity.
  30. *
  31. * An empty result means the check is universally available.
  32. *
  33. * @since 18.0.0
  34. */
  35. public function supportedEntities(): array;
  36. /**
  37. * returns whether the operation can be used in the requested scope.
  38. *
  39. * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At
  40. * time of writing these are SCOPE_ADMIN and SCOPE_USER.
  41. *
  42. * For possibly unknown future scopes the recommended behaviour is: if
  43. * user scope is permitted, the default behaviour should return `true`,
  44. * otherwise `false`.
  45. *
  46. * @since 18.0.0
  47. */
  48. public function isAvailableForScope(int $scope): bool;
  49. }