Skip to content

Commit

Permalink
event on some .well-known/ request
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Sep 24, 2020
1 parent 4d1d4da commit 99e9b7f
Show file tree
Hide file tree
Showing 10 changed files with 766 additions and 37 deletions.
7 changes: 7 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@
'OCP\\User\\Events\\UserLoggedOutEvent' => $baseDir . '/lib/public/User/Events/UserLoggedOutEvent.php',
'OCP\\User\\GetQuotaEvent' => $baseDir . '/lib/public/User/GetQuotaEvent.php',
'OCP\\Util' => $baseDir . '/lib/public/Util.php',
'OCP\\WellKnown\\IWellKnownManager' => $baseDir . '/lib/public/WellKnown/IWellKnownManager.php',
'OCP\\WellKnown\\Model\\IWellKnown' => $baseDir . '/lib/public/WellKnown/Model/IWellKnown.php',
'OCP\\WorkflowEngine\\EntityContext\\IContextPortation' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IContextPortation.php',
'OCP\\WorkflowEngine\\EntityContext\\IDisplayName' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayName.php',
'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php',
Expand Down Expand Up @@ -1370,6 +1372,11 @@
'OC\\User\\NoUserException' => $baseDir . '/lib/private/User/NoUserException.php',
'OC\\User\\Session' => $baseDir . '/lib/private/User/Session.php',
'OC\\User\\User' => $baseDir . '/lib/private/User/User.php',
'OC\\WellKnown\\Event\\WellKnownEvent' => $baseDir . '/lib/private/WellKnown/Event/WellKnownEvent.php',
'OC\\WellKnown\\Exceptions\\NotManagedWellKnownRequestException' => $baseDir . '/lib/private/WellKnown/Exceptions/NotManagedWellKnownRequestException.php',
'OC\\WellKnown\\Exceptions\\WellKnownRequestException' => $baseDir . '/lib/private/WellKnown/Exceptions/WellKnownRequestException.php',
'OC\\WellKnown\\Model\\WellKnown' => $baseDir . '/lib/private/WellKnown/Model/WellKnown.php',
'OC\\WellKnown\\WellKnownManager' => $baseDir . '/lib/private/WellKnown/WellKnownManager.php',
'OC_API' => $baseDir . '/lib/private/legacy/OC_API.php',
'OC_App' => $baseDir . '/lib/private/legacy/OC_App.php',
'OC_DB' => $baseDir . '/lib/private/legacy/OC_DB.php',
Expand Down
44 changes: 14 additions & 30 deletions lib/composer/composer/autoload_static.php

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions lib/private/WellKnown/Event/WellKnownEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

/**
* @copyright 2020, Maxence Lange <maxence@artificial-owl.com>
*
* @author Maxence Lange <maxence@artificial-owl.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OC\WellKnown\Event;

use OCP\EventDispatcher\Event;
use OCP\WellKnown\Model\IWellKnown;

/**
* Class WellKnownEvent
*
* @package OC\WellKnown\Events
* @since 21.0.0
*/
class WellKnownEvent extends Event {


/** @var IWellKnown */
private $wellKnown;


/**
* WellKnownEvent constructor.
*
* @param IWellKnown $wellKnown
*
* @since 21.0.0
*/
public function __construct(IWellKnown $wellKnown) {
parent::__construct();

$this->wellKnown = $wellKnown;
}


/**
* @return IWellKnown
* @since 21.0.0
*/
public function getWellKnown(): IWellKnown {
return $this->wellKnown;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

declare(strict_types=1);

/**
* @copyright 2020, Maxence Lange <maxence@artificial-owl.com>
*
* @author Maxence Lange <maxence@artificial-owl.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/


namespace OC\WellKnown\Exceptions;


use Exception;
use Throwable;


/**
* Class NotManagedWellKnownRequestException
*
* @package OC\WellKnown\Exceptions
* @since 21.0.0
*/
class NotManagedWellKnownRequestException extends Exception {


/** @var int */
private $errorCode;


/**
* WellKnownRequestException constructor.
*
* @param int $errorCode
* @param string $message
* @param int $code
* @param Throwable|null $previous
*/
public function __construct($errorCode = 404, $message = "", $code = 0, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
$this->errorCode = $errorCode;
}


/**
* @return int
* @since 21.0.0
*/
public function getErrorCode(): int {
return $this->errorCode;
}
}
69 changes: 69 additions & 0 deletions lib/private/WellKnown/Exceptions/WellKnownRequestException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

declare(strict_types=1);

/**
* @copyright 2020, Maxence Lange <maxence@artificial-owl.com>
*
* @author Maxence Lange <maxence@artificial-owl.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/


namespace OC\WellKnown\Exceptions;


use Exception;
use Throwable;


/**
* Class WellKnownRequestException
*
* @package OC\WellKnown\Exceptions
* @since 21.0.0
*/
class WellKnownRequestException extends Exception {


/** @var int */
private $errorCode;


/**
* WellKnownRequestException constructor.
*
* @param int $errorCode
* @param string $message
* @param int $code
* @param Throwable|null $previous
*/
public function __construct($errorCode = 404, $message = "", $code = 0, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
$this->errorCode = $errorCode;
}


/**
* @return int
* @since 21.0.0
*/
public function getErrorCode(): int {
return $this->errorCode;
}
}
Loading

0 comments on commit 99e9b7f

Please sign in to comment.