Skip to content

Commit

Permalink
Update autoloader
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed May 5, 2022
1 parent ad4fe1c commit 291eb93
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 56 deletions.
14 changes: 4 additions & 10 deletions apps/admin_audit/lib/Actions/GroupManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ class GroupManagement extends Action implements IEventListener {
public function handle(Event $event): void {
if ($event instanceof UserAddedEvent) {
$this->addUser($event->getGroup(), $event->getUser());
}

if ($event instanceof UserRemovedEvent) {
$this->addUser($event->getGroup(), $event->getUser());
}

if ($event instanceof GroupCreatedEvent) {
} else if ($event instanceof UserRemovedEvent) {
$this->removeUser($event->getGroup(), $event->getUser());
} else if ($event instanceof GroupCreatedEvent) {
$this->createGroup($event->getGroup());
}

if ($event instanceof GroupDeletedEvent) {
} else if ($event instanceof GroupDeletedEvent) {
$this->deleteGroup($event->getGroup());
}
}
Expand Down
24 changes: 7 additions & 17 deletions apps/admin_audit/lib/Actions/UserManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
use OCP\User\Events\UserCreatedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\User\Events\UserIdAssignedEvent;
use OCP\User\Events\UserIdUnAssignedEvent;
use OCP\User\Events\UserIdUnassignedEvent;

/**
* Class UserManagement logs all user management related actions.
Expand All @@ -51,25 +51,15 @@ class UserManagement extends Action implements IEventListener {
public function handle(Event $event): void {
if ($event instanceof UserCreatedEvent) {
$this->create($event->getUser()->getUID());
}

if ($event instanceof UserDeletedEvent) {
} else if ($event instanceof UserDeletedEvent) {
$this->delete($event->getUser()->getUID());
}

if ($event instanceof UserChangedEvent) {
} else if ($event instanceof UserChangedEvent) {
$this->change($event);
}

if ($event instanceof UserIdAssignedEvent) {
} else if ($event instanceof UserIdAssignedEvent) {
$this->assign($event->getName());
}

if ($event instanceof UserIdUnassignedEvent) {
$this->assign($event->getName());
}

if ($event instanceof PasswordUpdatedEvent) {
} else if ($event instanceof UserIdUnassignedEvent) {
$this->unassign($event->getName());
} else if ($event instanceof PasswordUpdatedEvent) {
$this->setPassword($event->getUser());
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
use OCP\User\Events\UserChangedEvent;
use OCP\User\Events\UserCreatedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\User\Events\UserIdUnAssignedEvent;
use OCP\User\Events\UserIdUnassignedEvent;
use OCP\User\Events\UserLoggedInEvent;
use OCP\User\Events\UserLoggedOutEvent;
use OCP\Util;
Expand Down Expand Up @@ -107,7 +107,7 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(UserChangedEvent::class, UserManagement::class);
$context->registerEventListener(PasswordUpdatedEvent::class, UserManagement::class);
$context->registerEventListener(UserIdAssignedEvent::class, UserManagement::class);
$context->registerEventListener(UserIdUnAssignedEvent::class, UserManagement::class);
$context->registerEventListener(UserIdUnassignedEvent::class, UserManagement::class);

// Group management
$context->registerEventListener(GroupCreatedEvent::class, GroupManagement::class);
Expand Down
12 changes: 6 additions & 6 deletions apps/user_ldap/ajax/clearMappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Mapping\GroupMapping;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\User\Events\BeforeUserIdUnAssignedEvent;
use OCP\User\Events\UserIdUnAssignedEvent;
use OCP\User\Events\BeforeUserIdUnassignedEvent;
use OCP\User\Events\UserIdUnassignedEvent;

// Check user and app status
\OC_JSON::checkAdminUser();
Expand All @@ -42,12 +42,12 @@
/** @var IEventDispatcher $dispatcher */
$dispatcher = \OC::$server->get(IEventDispatcher::class);
$result = $mapping->clearCb(
function ($uid) use ($dispatcher) {
$dispatcher->dispatchTyped(new BeforeUserIdUnAssignedEvent($uid));
function (string $uid) use ($dispatcher): void {
$dispatcher->dispatchTyped(new BeforeUserIdUnassignedEvent($uid));
\OC::$server->getUserManager()->emit('\OC\User', 'preUnassignedUserId', [$uid]);
},
function ($uid) use ($dispatcher) {
$dispatcher->dispatchTyped(new UserIdUnAssignedEvent($uid));
function (string $uid) use ($dispatcher): void {
$dispatcher->dispatchTyped(new UserIdUnassignedEvent($uid));
\OC::$server->getUserManager()->emit('\OC\User', 'postUnassignedUserId', [$uid]);
}
);
Expand Down
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Jobs/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*/
namespace OCA\User_LDAP\Jobs;

use OCA\User_LDAP\User\User;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OC\ServerNotAvailableException;
use OCA\User_LDAP\AccessFactory;
use OCA\User_LDAP\Configuration;
Expand All @@ -36,6 +33,9 @@
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\User;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IAvatarManager;
use OCP\IConfig;
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Mapping/AbstractMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function getListOfIdsByDn(array $fdns): array {
$qb->setParameter('hashList', $fdnsSlice, IQueryBuilder::PARAM_STR_ARRAY);
$this->collectResultsFromListOfIdsQuery($qb, $results);
$slice++;
} while (count($fdnsSlice) === 1000);
} while (count($fdnsSlice) >= 1000);

return $results;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/composer/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit53792487c5a8370acc0b06b1a864ff4c::getLoader();
3 changes: 3 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
'OCP\\User\\Events\\BeforePasswordUpdatedEvent' => $baseDir . '/lib/public/User/Events/BeforePasswordUpdatedEvent.php',
'OCP\\User\\Events\\BeforeUserCreatedEvent' => $baseDir . '/lib/public/User/Events/BeforeUserCreatedEvent.php',
'OCP\\User\\Events\\BeforeUserDeletedEvent' => $baseDir . '/lib/public/User/Events/BeforeUserDeletedEvent.php',
'OCP\\User\\Events\\BeforeUserIdUnassignedEvent' => $baseDir . '/lib/public/User/Events/BeforeUserIdUnassignedEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedInEvent' => $baseDir . '/lib/public/User/Events/BeforeUserLoggedInEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedInWithCookieEvent' => $baseDir . '/lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedOutEvent' => $baseDir . '/lib/public/User/Events/BeforeUserLoggedOutEvent.php',
Expand All @@ -593,6 +594,8 @@
'OCP\\User\\Events\\UserChangedEvent' => $baseDir . '/lib/public/User/Events/UserChangedEvent.php',
'OCP\\User\\Events\\UserCreatedEvent' => $baseDir . '/lib/public/User/Events/UserCreatedEvent.php',
'OCP\\User\\Events\\UserDeletedEvent' => $baseDir . '/lib/public/User/Events/UserDeletedEvent.php',
'OCP\\User\\Events\\UserIdAssignedEvent' => $baseDir . '/lib/public/User/Events/UserIdAssignedEvent.php',
'OCP\\User\\Events\\UserIdUnassignedEvent' => $baseDir . '/lib/public/User/Events/UserIdUnassignedEvent.php',
'OCP\\User\\Events\\UserLiveStatusEvent' => $baseDir . '/lib/public/User/Events/UserLiveStatusEvent.php',
'OCP\\User\\Events\\UserLoggedInEvent' => $baseDir . '/lib/public/User/Events/UserLoggedInEvent.php',
'OCP\\User\\Events\\UserLoggedInWithCookieEvent' => $baseDir . '/lib/public/User/Events/UserLoggedInWithCookieEvent.php',
Expand Down
3 changes: 3 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\User\\Events\\BeforePasswordUpdatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforePasswordUpdatedEvent.php',
'OCP\\User\\Events\\BeforeUserCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserCreatedEvent.php',
'OCP\\User\\Events\\BeforeUserDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserDeletedEvent.php',
'OCP\\User\\Events\\BeforeUserIdUnassignedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserIdUnassignedEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedInEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserLoggedInEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedInWithCookieEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserLoggedInWithCookieEvent.php',
'OCP\\User\\Events\\BeforeUserLoggedOutEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/BeforeUserLoggedOutEvent.php',
Expand All @@ -622,6 +623,8 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\User\\Events\\UserChangedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserChangedEvent.php',
'OCP\\User\\Events\\UserCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserCreatedEvent.php',
'OCP\\User\\Events\\UserDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserDeletedEvent.php',
'OCP\\User\\Events\\UserIdAssignedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserIdAssignedEvent.php',
'OCP\\User\\Events\\UserIdUnassignedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserIdUnassignedEvent.php',
'OCP\\User\\Events\\UserLiveStatusEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLiveStatusEvent.php',
'OCP\\User\\Events\\UserLoggedInEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLoggedInEvent.php',
'OCP\\User\\Events\\UserLoggedInWithCookieEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLoggedInWithCookieEvent.php',
Expand Down
12 changes: 6 additions & 6 deletions lib/public/User/Events/BeforeUserIdUnassignedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
/**
* @since 25.0.0
*/
class BeforeUserIdUnAssignedEvent extends Event {
private string $name;
class BeforeUserIdUnassignedEvent extends Event {
private string $userId;

/**
* @since 25.0.0
*/
public function __construct(string $name) {
public function __construct(string $userId) {
parent::__construct();
$this->name = $name;
$this->userId = $userId;
}

/**
* @since 25.0.0
*/
public function getName(): string {
return $this->name;
public function getUserId(): string {
return $this->userId;
}
}
10 changes: 5 additions & 5 deletions lib/public/User/Events/UserIdAssignedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
* @since 25.0.0
*/
class UserIdAssignedEvent extends Event {
private string $name;
private string $userId;

/**
* @since 25.0.0
*/
public function __construct(string $name) {
public function __construct(string $userId) {
parent::__construct();
$this->name = $name;
$this->userId = $userId;
}

/**
* @since 25.0.0
*/
public function getName(): string {
return $this->name;
public function getUserId(): string {
return $this->userId;
}
}
12 changes: 6 additions & 6 deletions lib/public/User/Events/UserIdUnassignedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
/**
* @since 25.0.0
*/
class UserIdUnAssignedEvent extends Event {
private string $name;
class UserIdUnassignedEvent extends Event {
private string $userId;

/**
* @since 25.0.0
*/
public function __construct(string $name) {
public function __construct(string $userId) {
parent::__construct();
$this->name = $name;
$this->userId = $userId;
}

/**
* @since 25.0.0
*/
public function getName(): string {
return $this->name;
public function getUserId(): string {
return $this->userId;
}
}

0 comments on commit 291eb93

Please sign in to comment.