Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 12, 2023

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented May 2, 2023

Summary

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

TODO

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

Screenshot

Bildschirmfoto vom 2023-05-09 16-22-19

Checklist

@kesselb
Copy link
Contributor

kesselb commented May 2, 2023

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

*
* @return string[]
*/
public function getManagerUids(): array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Those are very specific new methods in IUser, just for metadata elements. Maybe make it more generic so that it can absorb every kind of contact information we could give it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so too but that's tricky with types. Some properties are string, some are nullable string, this is a string array.

@skjnldsv skjnldsv mentioned this pull request May 3, 2023
@hamza221
Copy link
Contributor

hamza221 commented May 3, 2023

image
image

Copy link
Member

@nimishavijay nimishavijay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great design-wise!

@ChristophWurst
Copy link
Member Author

Frontend for the new user property

Is that done @hamza221 or do we miss anything?

@hamza221
Copy link
Contributor

hamza221 commented May 4, 2023

Frontend for the new user property

Is that done @hamza221 or do we miss anything?

Done

@ChristophWurst
Copy link
Member Author

ChristophWurst commented May 4, 2023

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

@ChristophWurst ChristophWurst added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 4, 2023
@ChristophWurst ChristophWurst marked this pull request as ready for review May 4, 2023 13:17
@ChristophWurst
Copy link
Member Author

/compile /

@@ -215,6 +231,7 @@
:show-config="showConfig"
:sub-admins-groups="subAdminsGroups"
:user="user"
:users="users"
Copy link
Member Author

@ChristophWurst ChristophWurst May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • BUG this only looks at the local users. If you go to a group you can only assign a manger from the same group. If you have thousands of users and only the first x are visible you can only pick from those x.

The multiselect has to search users on the backend

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hamza221 could you address this please? You will have to use the components async search callback feature and fetch users from the server

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems addressed. Users are looked up on the server now 👍

@ChristophWurst ChristophWurst marked this pull request as draft May 4, 2023 18:34
@ChristophWurst ChristophWurst added 2. developing Work in progress and removed 3. to review Waiting for reviews labels May 4, 2023
@skjnldsv skjnldsv mentioned this pull request May 9, 2023
@ChristophWurst
Copy link
Member Author

ChristophWurst commented May 9, 2023

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

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

@skjnldsv skjnldsv mentioned this pull request May 9, 2023
@skjnldsv skjnldsv modified the milestones: Nextcloud 27, Nextcloud 28 May 9, 2023
@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from 960893d to 9ebbe1f Compare May 10, 2023 14:01
@ChristophWurst
Copy link
Member Author

Files sharing acceptance test fails. Most likely unrelated?

@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from 9ebbe1f to 3a1bb8b Compare May 11, 2023 06:38
@skjnldsv

This comment was marked as resolved.

@ChristophWurst

This comment was marked as resolved.

@skjnldsv

This comment was marked as resolved.

@ChristophWurst
Copy link
Member Author

ChristophWurst commented May 11, 2023

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

😌

The tests are broken in general. Everything is fine.

@ChristophWurst
Copy link
Member Author

acceptance-app-files-sharing is suspicious

image

@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from 3a1bb8b to 549be4c Compare May 11, 2023 12:30
@ChristophWurst
Copy link
Member Author

Rebased because I can't restart Drone

@ChristophWurst
Copy link
Member Author

acceptance-app-files-sharing fails reliably

@danxuliu
Copy link
Member

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');
	}

@ChristophWurst
Copy link
Member Author

You are the best, honestly.

@ChristophWurst
Copy link
Member Author

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

@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from 1c19b59 to f502666 Compare May 12, 2023 07:02
@blizzz
Copy link
Member

blizzz commented May 12, 2023

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

@ChristophWurst
Copy link
Member Author

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

@blizzz
Copy link
Member

blizzz commented May 12, 2023

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

Wait until #38214 is merged

@@ -142,6 +142,20 @@
<div v-if="showConfig.showStoragePath" class="storageLocation" />
<div v-if="showConfig.showUserBackend" class="userBackend" />
<div v-if="showConfig.showLastLogin" class="lastLogin" />
<div :class="{'icon-loading-small': loading.manager}" class="modal__item managers">
<NcMultiselect ref="manager"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NcMultiselect is actually deprecated because it is not accessible, but I see it's used in this flie all over, so okay for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst
Copy link
Member Author

showtime

@ChristophWurst
Copy link
Member Author

ChristophWurst commented May 12, 2023

showtime

there are not just bundle conflicts. we have to adjust the front-end after #37870

@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from f502666 to e89971d Compare May 12, 2023 10:01
@ChristophWurst
Copy link
Member Author

the table looks bad but that's coming from #37870 (comment)

the feature works

Bildschirmfoto vom 2023-05-12 12-04-12

Co-Authored-By: hamza221 <hamzamahjoubi221@gmail.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst force-pushed the feat/users/store-load-manager-uid branch from e89971d to 1381c4c Compare May 12, 2023 11:56
@ChristophWurst
Copy link
Member Author

Psalm failure is unrelated

@ChristophWurst ChristophWurst merged commit 2440314 into master May 12, 2023
@ChristophWurst ChristophWurst deleted the feat/users/store-load-manager-uid branch May 12, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish feature: users and groups integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assign managers to users and map value in the system address book