Skip to content

Commit

Permalink
code style adjustment
Browse files Browse the repository at this point in the history
initial $config variable in federatedfilesharing\ocmController and files_sharing\externalController
  • Loading branch information
navid-shokri committed Apr 13, 2023
1 parent ea01c1d commit fc02a21
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions apps/federatedfilesharing/lib/Controller/OcmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\IConfig;

/**
* Class OcmController
Expand Down Expand Up @@ -75,6 +76,11 @@ class OcmController extends Controller {
*/
protected $logger;

/**
* @var IConfig
*/
protected $config;

/**
* OcmController constructor.
*
Expand Down Expand Up @@ -105,6 +111,7 @@ public function __construct(
$this->addressHandler = $addressHandler;
$this->fedShareManager = $fedShareManager;
$this->logger = $logger;
$this->config = \OC::$server->getConfig();
}

/**
Expand Down Expand Up @@ -181,7 +188,7 @@ public function createShare(
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
$controller = \OC::$server->query($controllerClass);
return $controller->createShare(
return $controller->createShare(
$shareWith,
$name,
$description,
Expand Down Expand Up @@ -306,7 +313,7 @@ public function processNotification(
$controllerClass = $this->config->getSystemValue('sharing.ocmController');
if ($controllerClass !== '') {
$controller = \OC::$server->query($controllerClass);
return $controller->processNotification(
return $controller->processNotification(
$notificationType,
$resourceType,
$providerId,
Expand Down
12 changes: 10 additions & 2 deletions apps/files_sharing/lib/Controllers/ExternalSharesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\IRequest;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\IConfig;

/**
* Class ExternalSharesController
Expand All @@ -50,6 +51,11 @@ class ExternalSharesController extends Controller {
*/
private $dispatcher;

/**
* @var IConfig
*/
protected $config;

/**
* ExternalSharesController constructor.
*
Expand All @@ -70,6 +76,8 @@ public function __construct(
$this->externalManager = $externalManager;
$this->clientService = $clientService;
$this->dispatcher = $eventDispatcher;
$this->config = \OC::$server->getConfig();

// Allow other apps to add an external manager for user-to-group shares
$managerClass = $this->config->getSystemValue('sharing.groupExternalManager');
if ($managerClass !== '') {
Expand All @@ -88,7 +96,7 @@ public function index() {
if ($this->groupExternalManager !== null) {
$federatedGroupResult = $this->groupExternalManager->getOpenShares();
}
$result = array_merge($federatedGroupResult, $this->externalManager->getOpenShares());
$result = array_merge($federatedGroupResult, $this->externalManager->getOpenShares());
return new JSONResponse($result);
}

Expand All @@ -100,7 +108,7 @@ public function index() {
* @return JSONResponse
*/
public function create($id, $share_type) {
if($share_type === "group" && $this->groupExternalManager !== null) {
if ($share_type === "group" && $this->groupExternalManager !== null) {
$manager = $this->groupExternalManager;
} else {
$manager = $this->externalManager;
Expand Down

0 comments on commit fc02a21

Please sign in to comment.