server icon indicating copy to clipboard operation
server copied to clipboard

feat(users): Store and load a user's manager

Open ChristophWurst opened this issue 1 year ago • 5 comments

  • Resolves: https://github.com/nextcloud/server/issues/37963

Summary

Allow (sub) admins to set a user's manager.

TODO

  • [x] Backend for the new user property
  • [x] Frontend for the new user property
  • [x] System address book mapping
  • [x] Trigger update event for assigned admin so the system address book card gets regenerated

Checklist

ChristophWurst avatar May 02 '23 07:05 ChristophWurst

Nice to have: remove the uid when the manager is deleted. A listener for user deleted is already there: https://github.com/nextcloud/server/blob/master/apps/provisioning_api/lib/Listener/UserDeletedListener.php

kesselb avatar May 02 '23 08:05 kesselb

image image

hamza221 avatar May 03 '23 16:05 hamza221

Frontend for the new user property

Is that done @hamza221 or do we miss anything?

ChristophWurst avatar May 04 '23 11:05 ChristophWurst

Frontend for the new user property

Is that done @hamza221 or do we miss anything?

Done

hamza221 avatar May 04 '23 11:05 hamza221

Mapping is done too. ~~The only missing piece is change detection and regeneration of the card when the admin property is updated.~~ done

ChristophWurst avatar May 04 '23 12:05 ChristophWurst

/compile /

ChristophWurst avatar May 04 '23 18:05 ChristophWurst

  • [x] BUG can't set myself as manager of another user

Turns out uid!=displayname for my test user. searching by display name works :+1:

ChristophWurst avatar May 09 '23 07:05 ChristophWurst

@skjnldsv this feature is scheduled for 27

ChristophWurst avatar May 09 '23 14:05 ChristophWurst

/compile amend /

ChristophWurst avatar May 09 '23 14:05 ChristophWurst

@skjnldsv this feature is scheduled for 27

as long as it's merged before Tuesday morning :wink:

skjnldsv avatar May 09 '23 15:05 skjnldsv

image

https://github.com/nextcloud/server/issues/38145 will probably address that

ChristophWurst avatar May 09 '23 16:05 ChristophWurst

/compile amend /

ChristophWurst avatar May 10 '23 08:05 ChristophWurst

Error: apps/files_external/lib/Lib/Storage/AmazonS3.php:339:18: InvalidReturnType: The declared return type 'false|resource' for OCA\Files_External\Lib\Storage\AmazonS3::opendir is incorrect, got 'bool|resource' (see https://psalm.dev/011)

and similar but can't figure out why this shows here. The PR doesn't touch any file handling.

ChristophWurst avatar May 10 '23 08:05 ChristophWurst

X-MANAGERSNAME;UID=admin;X-NC-SCOPE=v2-local:Christoph Wurst

works flawless combined with https://github.com/nextcloud/server/pull/38048

ChristophWurst avatar May 10 '23 09:05 ChristophWurst

Files sharing acceptance test fails. Most likely unrelated?

ChristophWurst avatar May 10 '23 15:05 ChristophWurst

--- Failed scenarios:

    /drone/src/build/integration/features/contacts-menu.feature:74
    /drone/src/build/integration/features/contacts-menu.feature:109
    /drone/src/build/integration/features/contacts-menu.feature:164
    /drone/src/build/integration/features/contacts-menu.feature:178

Seems related though

skjnldsv avatar May 11 '23 07:05 skjnldsv

@skjnldsv are you sure? The contacts menu integration tests fail on so many PRs recently

ChristophWurst avatar May 11 '23 07:05 ChristophWurst

@skjnldsv are you sure? The contacts menu integration tests fail on so many PRs recently

seems like you're right indeed :)

skjnldsv avatar May 11 '23 07:05 skjnldsv

Took a random other PR and it's the same tests that fail: https://github.com/nextcloud/server/pull/38188 https://drone.nextcloud.com/nextcloud/server/33791/36/3

:relieved:

The tests are broken in general. Everything is fine.

ChristophWurst avatar May 11 '23 07:05 ChristophWurst

acceptance-app-files-sharing is suspicious

image

ChristophWurst avatar May 11 '23 07:05 ChristophWurst

Rebased because I can't restart Drone

ChristophWurst avatar May 11 '23 12:05 ChristophWurst

acceptance-app-files-sharing fails reliably

ChristophWurst avatar May 11 '23 15:05 ChristophWurst

When locally running the acceptance tests the Nextcloud logs show (docker exec nextcloud-local-test-acceptance tail -f /var/www/html/data/nextcloud.log) the error ...POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Class OCA\\Notifications\\FakeUser contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (OCP\\IUser::getManagerUids, OCP\\IUser::setManagerUids) at /nextcloud/apps/notifications/lib/FakeUser.php#30"....

The Notifications app is installed when setting up the acceptance tests environment, but if present the existing app will be used without downloading it again. The failing acceptance tests pass after adding the following to an existing apps/notifications/lib/FakeUser.php:

	public function getManagerUids(): array {
		throw new \RuntimeException('Not implemented');
	}

	public function setManagerUids(array $uids): void {
		throw new \RuntimeException('Not implemented');
	}

danxuliu avatar May 12 '23 04:05 danxuliu

You are the best, honestly.

ChristophWurst avatar May 12 '23 06:05 ChristophWurst

Alright. I'm giving this PR a final rebase. https://github.com/nextcloud/notifications/pull/1544 is pending. If it gets merged soon the tests will pass here.

ChristophWurst avatar May 12 '23 07:05 ChristophWurst

seems some rebuilds are needed. fyi, there'll be a nc/vue bump following as well.

blizzz avatar May 12 '23 07:05 blizzz

OK can you tell me if I should rebase already or wait for the vue bump merge @blizzz? Cheers

ChristophWurst avatar May 12 '23 07:05 ChristophWurst

OK can you tell me if I should rebase already or wait for the vue bump merge @blizzz? Cheers

Wait until https://github.com/nextcloud/server/pull/38214 is merged

blizzz avatar May 12 '23 08:05 blizzz

showtime

ChristophWurst avatar May 12 '23 09:05 ChristophWurst

showtime

there are not just bundle conflicts. we have to adjust the front-end after https://github.com/nextcloud/server/pull/37870

ChristophWurst avatar May 12 '23 09:05 ChristophWurst