Refactored "changed*" methods to update

This commit is contained in:
Netkas 2023-06-23 00:30:38 -04:00
parent 42d331408c
commit 8f3be08f57
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
4 changed files with 12 additions and 12 deletions

View file

@ -65,7 +65,7 @@
case Methods::GET_CLIENT: case Methods::GET_CLIENT:
self::getClient($input); self::getClient($input);
break; break;
case Methods::CHANGE_CLIENT_NAME: case Methods::UPDATE_CLIENT_NAME:
self::changeClientName($input); self::changeClientName($input);
break; break;
@ -212,7 +212,7 @@
try try
{ {
self::$federation_lib->changeClientName(null, $uuid, $name); self::$federation_lib->updateClientName(null, $uuid, $name);
print('OK' . PHP_EOL); print('OK' . PHP_EOL);
} }
catch(ClientNotFoundException) catch(ClientNotFoundException)

View file

@ -9,8 +9,8 @@
public const CREATE_CLIENT = 'create_client'; public const CREATE_CLIENT = 'create_client';
public const GET_CLIENT = 'get_client'; public const GET_CLIENT = 'get_client';
public const CHANGE_CLIENT_NAME = 'change_client_name'; public const UPDATE_CLIENT_NAME = 'update_client_name';
public const CHANGE_CLIENT_DESCRIPTION = 'change_client_description'; public const UPDATE_CLIENT_DESCRIPTION = 'update_client_description';
public const ALL = [ public const ALL = [
self::PING, self::PING,
@ -18,7 +18,7 @@
self::CREATE_CLIENT, self::CREATE_CLIENT,
self::GET_CLIENT, self::GET_CLIENT,
self::CHANGE_CLIENT_NAME, self::UPDATE_CLIENT_NAME,
self::CHANGE_CLIENT_DESCRIPTION self::UPDATE_CLIENT_DESCRIPTION
]; ];
} }

View file

@ -240,9 +240,9 @@
* @throws InternalServerException * @throws InternalServerException
* @throws InvalidClientNameException * @throws InvalidClientNameException
*/ */
public function changeClientName(?ClientIdentity $identity, string $client_uuid, ?string $new_name): bool public function updateClientName(?ClientIdentity $identity, string $client_uuid, ?string $new_name): bool
{ {
if(!$this->checkPermission(Methods::CHANGE_CLIENT_NAME, $this->resolveIdentity($identity))) if(!$this->checkPermission(Methods::UPDATE_CLIENT_NAME, $this->resolveIdentity($identity)))
{ {
throw new Exceptions\Standard\AccessDeniedException('You do not have sufficient permission to change the name of a client'); throw new Exceptions\Standard\AccessDeniedException('You do not have sufficient permission to change the name of a client');
} }

View file

@ -57,8 +57,8 @@
tm::addFunction('client_registerClient', [$this, 'registerClient']); tm::addFunction('client_registerClient', [$this, 'registerClient']);
tm::addFunction('client_getClient', [$this, 'getClient']); tm::addFunction('client_getClient', [$this, 'getClient']);
tm::addFunction('client_changeClientName', [$this, 'changeClientName']); tm::addFunction('client_changeClientName', [$this, 'changeClientName']);
tm::addFunction('client_changeClientDescription', [$this, 'changeClientDescription']); tm::addFunction('client_changeClientDescription', [$this, 'updateClientDescription']);
tm::addFunction('client_changeClientPermissionRole', [$this, 'changeClientPermissionRole']); tm::addFunction('client_changeClientPermissionRole', [$this, 'updateClientPermissionRole']);
tm::addFunction('client_updateLastSeen', [$this, 'updateLastSeen']); tm::addFunction('client_updateLastSeen', [$this, 'updateLastSeen']);
tm::addFunction('client_listClients', [$this, 'listClients']); tm::addFunction('client_listClients', [$this, 'listClients']);
tm::addFunction('client_getTotalClients', [$this, 'getTotalClients']); tm::addFunction('client_getTotalClients', [$this, 'getTotalClients']);
@ -298,7 +298,7 @@
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidClientDescriptionException * @throws InvalidClientDescriptionException
*/ */
public function changeClientDescription(string|ClientRecord $client_uuid, ?string $description=null): void public function updateClientDescription(string|ClientRecord $client_uuid, ?string $description=null): void
{ {
if($client_uuid instanceof ClientRecord) if($client_uuid instanceof ClientRecord)
{ {
@ -375,7 +375,7 @@
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidPermissionRoleException * @throws InvalidPermissionRoleException
*/ */
public function changeClientPermissionRole(string|ClientRecord $client_uuid, int $permission_role): void public function updateClientPermissionRole(string|ClientRecord $client_uuid, int $permission_role): void
{ {
if($client_uuid instanceof ClientRecord) if($client_uuid instanceof ClientRecord)
{ {