diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php index 5335036cde..c55c14ef9b 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/AuthMethods/Update.php @@ -28,7 +28,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/auth-methods/:methodId') ->httpAlias('/v1/projects/:projectId/auth/:methodId') ->desc('Update project auth method status') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index 41a6168b07..83b40527a8 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/membership-privacy') ->httpAlias('/v1/projects/:projectId/auth/memberships-privacy') ->desc('Update membership privacy policy') @@ -50,11 +50,11 @@ class Update extends Action ) ], )) - ->param('userId', null, new Boolean(), 'Set to true if you want make user ID visible to all team members, or false to hide it.', optional: true) - ->param('userEmail', null, new Boolean(), 'Set to true if you want make user email visible to all team members, or false to hide it.', optional: true) - ->param('userPhone', null, new Boolean(), 'Set to true if you want make user phone number visible to all team members, or false to hide it.', optional: true) - ->param('userName', null, new Boolean(), 'Set to true if you want make user name visible to all team members, or false to hide it.', optional: true) - ->param('userMFA', null, new Boolean(), 'Set to true if you want make user MFA status visible to all team members, or false to hide it.', optional: true) + ->param('userId', false, new Boolean(), 'Set to true if you want make user ID visible to all team members, or false to hide it.') + ->param('userEmail', false, new Boolean(), 'Set to true if you want make user email visible to all team members, or false to hide it.') + ->param('userPhone', false, new Boolean(), 'Set to true if you want make user phone number visible to all team members, or false to hide it.') + ->param('userName', false, new Boolean(), 'Set to true if you want make user name visible to all team members, or false to hide it.') + ->param('userMFA', false, new Boolean(), 'Set to true if you want make user MFA status visible to all team members, or false to hide it.') ->inject('response') ->inject('dbForPlatform') ->inject('project') @@ -64,11 +64,11 @@ class Update extends Action } public function action( - ?bool $userId, - ?bool $userEmail, - ?bool $userPhone, - ?bool $userName, - ?bool $userMFA, + bool $userId, + bool $userEmail, + bool $userPhone, + bool $userName, + bool $userMFA, Response $response, Database $dbForPlatform, Document $project, @@ -77,21 +77,11 @@ class Update extends Action ): void { $auths = $project->getAttribute('auths', []); - if ($userId !== null) { - $auths['membershipsUserId'] = $userId; - } - if ($userEmail !== null) { - $auths['membershipsUserEmail'] = $userEmail; - } - if ($userPhone !== null) { - $auths['membershipsUserPhone'] = $userPhone; - } - if ($userName !== null) { - $auths['membershipsUserName'] = $userName; - } - if ($userMFA !== null) { - $auths['membershipsMfa'] = $userMFA; - } + $auths['membershipsUserId'] = $userId; + $auths['membershipsUserEmail'] = $userEmail; + $auths['membershipsUserPhone'] = $userPhone; + $auths['membershipsUserName'] = $userName; + $auths['membershipsMfa'] = $userMFA; $updates = new Document([ 'auths' => $auths, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php index d7ee99fbfe..0084dfe8e1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordDictionary/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/password-dictionary') ->httpAlias('/v1/projects/:projectId/auth/password-dictionary') ->desc('Update password dictionary policy') @@ -50,7 +50,7 @@ class Update extends Action ) ], )) - ->param('enabled', null, new Boolean(), 'Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid.') + ->param('enabled', false, new Boolean(), 'Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid.') ->inject('response') ->inject('dbForPlatform') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php index 84861a19e1..3c0beffccc 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordHistory/Update.php @@ -27,7 +27,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/password-history') ->httpAlias('/v1/projects/:projectId/auth/password-history') ->desc('Update password history policy') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php index 435f00fc39..cb886cbd5a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordPersonalData/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/password-personal-data') ->httpAlias('/v1/projects/:projectId/auth/personal-data') ->desc('Update password personal data policy') @@ -51,7 +51,7 @@ class Update extends Action ], )) // TODO: Split into more toggles, simiplar to membership privacy policy - ->param('enabled', null, new Boolean(), 'Toggle password personal data policy. Set to true if you want to block passwords including user\'s personal data, or false to allow it. When changing this policy, existing passwords remain valid.') + ->param('enabled', false, new Boolean(), 'Toggle password personal data policy. Set to true if you want to block passwords including user\'s personal data, or false to allow it. When changing this policy, existing passwords remain valid.') ->inject('response') ->inject('dbForPlatform') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php index 79653d46ad..fb68081cd2 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionAlert/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/session-alert') ->httpAlias('/v1/projects/:projectId/auth/session-alerts') ->desc('Update session alert policy') @@ -50,7 +50,7 @@ class Update extends Action ) ], )) - ->param('enabled', null, new Boolean(), 'Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts.') + ->param('enabled', false, new Boolean(), 'Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts.') ->inject('response') ->inject('dbForPlatform') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php index 0a7f33218a..95ec9f1a06 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionDuration/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/session-duration') ->httpAlias('/v1/projects/:projectId/auth/duration') ->desc('Update session duration policy') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php index a1feb67346..bdc37779a1 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionInvalidation/Update.php @@ -26,7 +26,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/session-invalidation') ->httpAlias('/v1/projects/:projectId/auth/session-invalidation') ->desc('Update session invalidation policy') @@ -50,7 +50,7 @@ class Update extends Action ) ], )) - ->param('enabled', null, new Boolean(), 'Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active.') + ->param('enabled', false, new Boolean(), 'Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active.') ->inject('response') ->inject('dbForPlatform') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php index 936a541249..458d54667b 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/SessionLimit/Update.php @@ -27,7 +27,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/session-limit') ->httpAlias('/v1/projects/:projectId/auth/max-sessions') ->desc('Update session limit policy') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php index 2b7e704853..52cce2ea0a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/UserLimit/Update.php @@ -27,7 +27,7 @@ class Update extends Action public function __construct() { $this - ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) // Should be PUT ->setHttpPath('/v1/project/policies/user-limit') ->httpAlias('/v1/projects/:projectId/auth/limit') ->desc('Update user limit policy')