Refactor user_ldap group membership cache and add check-group command#39446
Refactor user_ldap group membership cache and add check-group command#39446
Conversation
| * @method void setGroupid(string $groupid) | ||
| * @method string getGroupid() | ||
| */ | ||
| class GroupMembership extends Entity { |
Check notice
Code scanning / Psalm
PropertyNotSetInConstructor
| */ | ||
| class GroupMembership extends Entity { | ||
| /** @var string */ | ||
| protected $groupid; |
Check notice
Code scanning / Psalm
PropertyNotSetInConstructor
| protected $groupid; | ||
|
|
||
| /** @var string */ | ||
| protected $userid; |
Check notice
Code scanning / Psalm
PropertyNotSetInConstructor
173062a to
33ad29a
Compare
bce4a6e to
bb584c2
Compare
{
"level":3,
"message":"Table \"oc_ldap_group_membership\" has no primary key and therefor will not behave sane in clustered setups. This will throw an exception and not be installable in a future version of Nextcloud.",
}
|
c6b9696 to
c3c770a
Compare
|
|
||
| protected function execute(InputInterface $input, OutputInterface $output): int { | ||
| $this->dispatcher->addListener(GroupCreatedEvent::class, fn ($event) => $this->onGroupCreatedEvent($event, $output)); | ||
| $this->dispatcher->addListener(UserAddedEvent::class, fn ($event) => $this->onUserAddedEvent($event, $output)); |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion
| protected function execute(InputInterface $input, OutputInterface $output): int { | ||
| $this->dispatcher->addListener(GroupCreatedEvent::class, fn ($event) => $this->onGroupCreatedEvent($event, $output)); | ||
| $this->dispatcher->addListener(UserAddedEvent::class, fn ($event) => $this->onUserAddedEvent($event, $output)); | ||
| $this->dispatcher->addListener(UserRemovedEvent::class, fn ($event) => $this->onUserRemovedEvent($event, $output)); |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion
|
c3c770a to
8c80749
Compare
|
The |
|
Note: I looked into using LazyUser for events, but the test expects the event to only fire for existing users, which makes sense I suppose, so I abandoned the idea. |
Move away from serialized arrays. Also use a QBMapper class for the new table. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This should be handled when mapping groups, not when registering their members. An empty group may still exist. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
|
Rebased and squashed |
1d07a76 to
a080811
Compare
Summary
Refactor user_ldap group membership cache, to be able to easily check if a membership is known or not.
Add a command check-group which works like check-user, with the same --update option to force update from LDAP.
TODO
--update(currently not the case)Checklist