Extend missing check classes

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-09-06 13:59:41 +02:00 committed by Arthur Schiwon
parent 5891ec602f
commit 32279ed062
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
4 changed files with 54 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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 [];
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}