diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-09-06 13:59:41 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-09 22:56:05 +0200 |
commit | 32279ed062b92e58c45cc87d0ecab41075cad3dc (patch) | |
tree | f949c55160710540e9f35fd8dce4c1b5f671c14c /apps/workflowengine/lib/Check | |
parent | 5891ec602f45cebd7d991814c2ca57929f9085ed (diff) | |
download | nextcloud-server-32279ed062b92e58c45cc87d0ecab41075cad3dc.tar.gz nextcloud-server-32279ed062b92e58c45cc87d0ecab41075cad3dc.zip |
Extend missing check classes
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/lib/Check')
4 files changed, 54 insertions, 0 deletions
diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 6fa4cfc8800..c386168f597 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -151,4 +151,32 @@ class RequestRemoteAddress implements ICheck { } return str_pad($binaryIp, 128, '0', STR_PAD_RIGHT); } + + /** + * returns a list of Entities the checker supports. The values must match + * the class name of the entity. + * + * An empty result means the check is universally available. + * + * @since 18.0.0 + */ + public function supportedEntities(): array { + return []; + } + + /** + * returns whether the operation can be used in the requested scope. + * + * Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At + * time of writing these are SCOPE_ADMIN and SCOPE_USER. + * + * For possibly unknown future scopes the recommended behaviour is: if + * user scope is permitted, the default behaviour should return `true`, + * otherwise `false`. + * + * @since 18.0.0 + */ + public function isAvailableForScope(int $scope): bool { + return true; + } } diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index 0f5322b4759..79696583cdb 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -130,4 +130,17 @@ class RequestTime implements ICheck { public function isAvailableForScope(int $scope): bool { return true; } + + /** + * returns a list of Entities the checker supports. The values must match + * the class name of the entity. + * + * An empty result means the check is universally available. + * + * @since 18.0.0 + */ + public function supportedEntities(): array { + return []; + } + } diff --git a/apps/workflowengine/lib/Check/RequestUserAgent.php b/apps/workflowengine/lib/Check/RequestUserAgent.php index 2b2e3015557..1abb56bbe2d 100644 --- a/apps/workflowengine/lib/Check/RequestUserAgent.php +++ b/apps/workflowengine/lib/Check/RequestUserAgent.php @@ -24,6 +24,7 @@ namespace OCA\WorkflowEngine\Check; use OCP\IL10N; use OCP\IRequest; +use OCP\WorkflowEngine\IManager; class RequestUserAgent extends AbstractStringCheck { @@ -83,4 +84,5 @@ class RequestUserAgent extends AbstractStringCheck { public function isAvailableForScope(int $scope): bool { return true; } + } diff --git a/apps/workflowengine/lib/Check/UserGroupMembership.php b/apps/workflowengine/lib/Check/UserGroupMembership.php index fd6ba00d092..4b06dbd2da4 100644 --- a/apps/workflowengine/lib/Check/UserGroupMembership.php +++ b/apps/workflowengine/lib/Check/UserGroupMembership.php @@ -28,6 +28,7 @@ use OCP\IL10N; use OCP\IUser; use OCP\IUserSession; use OCP\WorkflowEngine\ICheck; +use OCP\WorkflowEngine\IManager; class UserGroupMembership implements ICheck { @@ -111,4 +112,14 @@ class UserGroupMembership implements ICheck { return $this->cachedGroupMemberships; } + + public function supportedEntities(): array { + // universal by default + return []; + } + + public function isAvailableForScope(int $scope): bool { + // admin only by default + return $scope === IManager::SCOPE_ADMIN; + } } |