mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
feat(OCM-invites): Fix psalm issues
Signed-off-by: Micke Nordin <kano@sunet.se>
This commit is contained in:
parent
616447413e
commit
b0a523b999
6 changed files with 23 additions and 21 deletions
|
|
@ -40,7 +40,7 @@ class Capabilities implements ICapability {
|
|||
* endPoint: string,
|
||||
* publicKey?: array{
|
||||
* keyId: string,
|
||||
* publicKeyPem: string,
|
||||
* publicKeyPem: string
|
||||
* },
|
||||
* provider: string,
|
||||
* resourceTypes: list<array{
|
||||
|
|
@ -50,9 +50,10 @@ class Capabilities implements ICapability {
|
|||
* }>,
|
||||
* version: string,
|
||||
* capabilities: array{
|
||||
* string,
|
||||
* string
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* } OCM provider information
|
||||
* @throws OCMArgumentException
|
||||
*/
|
||||
public function getCapabilities() {
|
||||
|
|
|
|||
|
|
@ -235,17 +235,14 @@ class RequestHandlerController extends Controller {
|
|||
* and recipients implementing the OCM invitation workflow MAY refuse to process
|
||||
* shares coming from unknown parties.
|
||||
*
|
||||
* @param string $recipientProvider
|
||||
* @param string $token
|
||||
* @param string $userId
|
||||
* @param string $email
|
||||
* @param string $name
|
||||
* @return JSONResponse
|
||||
* 200: Invitation accepted
|
||||
* 400: Invalid token
|
||||
* 403: Invitation token does not exist
|
||||
* 409: User is already known by the OCM provider
|
||||
* spec link: https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post
|
||||
* @param string $recipientProvider The address of the recipent's provider
|
||||
* @param string $token The token used for the invitation
|
||||
* @param string $userId The userId of the recipient at the recipient's provider
|
||||
* @param string $email The email address of the recipient
|
||||
* @param string $name The display name of the recipient
|
||||
*
|
||||
* @return JSONResponse<Http::STATUS_OK|Http::STATUS_FORBIDDEN|Http::STATUS_BAD_REQUEST|Http::STATUS_CONFLICT, array{email?: null|string, error?: true, message?: string, name?: string, userID?: string}, array<never, never>>
|
||||
*
|
||||
*/
|
||||
#[PublicPage]
|
||||
#[NoCSRFRequired]
|
||||
|
|
@ -255,6 +252,14 @@ class RequestHandlerController extends Controller {
|
|||
|
||||
$updated = $this->timeFactory->getTime();
|
||||
|
||||
/**
|
||||
* Note: Not implementing 404 Invitation token does not exist, instead using 400
|
||||
* 200: Invitation accepted
|
||||
* 400: Invalid token
|
||||
* 403: Invitation token does not exist
|
||||
* 409: User is already known by the OCM provider
|
||||
* spec link: https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post
|
||||
*/
|
||||
if ($token === '') {
|
||||
$response = new JSONResponse(['message' => 'Invalid or non existing token', 'error' => true], Http::STATUS_BAD_REQUEST);
|
||||
$response->throttle();
|
||||
|
|
@ -274,8 +279,6 @@ class RequestHandlerController extends Controller {
|
|||
$response->throttle();
|
||||
return $response;
|
||||
}
|
||||
// Note: Not implementing 404 Invitation token does not exist, instead using 400
|
||||
|
||||
if ($invitation->isAccepted() === true) {
|
||||
$response = ['message' => 'Invite already accepted', 'error' => true];
|
||||
$status = Http::STATUS_CONFLICT;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ use OCP\DB\Types;
|
|||
*/
|
||||
|
||||
class FederatedInvite extends Entity {
|
||||
|
||||
/**
|
||||
* @var bool $accepted
|
||||
*/
|
||||
|
|
@ -50,7 +49,7 @@ class FederatedInvite extends Entity {
|
|||
*/
|
||||
protected $createdAt;
|
||||
/**
|
||||
* @var $int $expiredAt
|
||||
* @var ?int $expiredAt
|
||||
*/
|
||||
protected $expiredAt;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\CloudFederationAPI\Events;
|
||||
|
||||
use OCA\CloudFederationApi\Db\FederatedInvite;
|
||||
use OCA\CloudFederationAPI\Db\FederatedInvite;
|
||||
use OCP\EventDispatcher\Event;
|
||||
|
||||
class FederatedInviteAcceptedEvent extends Event {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ use OCP\Migration\IOutput;
|
|||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
class Version1016Date202502262004 extends SimpleMigrationStep {
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class OCMProvider implements IOCMProvider {
|
|||
/**
|
||||
* @param array $capabilities
|
||||
*
|
||||
* @return this
|
||||
* @return $this
|
||||
*/
|
||||
public function setCapabilities(array $capabilities): static {
|
||||
foreach ($capabilities as $key => $value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue