Renamed userPrompt to userPromptComponent and add userListComponent id
ClosedPublic

Authored by antlarr on Sep 27 2016, 3:58 PM.

Details

Summary

Renamed userPrompt to userPromptComponent and add an id
(userListComponent) to the initialItem Login component.

Disable user list when there are too many users in the system

In sddm 0.14, there's a userModel.disableAvatarsThreshold property
that defines how many users are "too many" in the system so loading of
avatars should be disabled. This commit honors that property, so if
there are more than disableAvatarsThreshold users, then the user list
is disabled and a prompt is shown to ask for a username and password.
If the property is not available (for example, because sddm 0.13 is
being used) then it works as usual.

This threshold is specially useful for large enterprises with NFS
automounted home directories. In such environments, using sddm while
avatars are enabled results in all remote home directories being
mounted in the system before one user is able to log in. This has been
reported to take hours in cases with thousands of users.

By default the threshold has a value of 7, but it can be modified
in sddm.conf, under the Theme section, in the
UsersThresholdToDisableAvatars variable.

Diff Detail

Repository
R120 Plasma Workspace
Branch
Plasma/5.8
Lint
No Linters Available
Unit
No Unit Test Coverage
antlarr updated this revision to Diff 6954.Sep 27 2016, 3:58 PM
antlarr retitled this revision from to Renamed userPrompt to userPromptComponent and add userListComponent id.
antlarr updated this object.
antlarr edited the test plan for this revision. (Show Details)
antlarr added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptSep 27 2016, 3:58 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

Concept is good, just need to do some code shuffling.

lookandfeel/contents/components/SessionManagementScreen.qml
60

this component is shared with the lockscreen and user switcher, you're going to be generating warnings there.

but from the other comment, we don't actually want this check here anyway.

69

Even when we're not showing the users we still want this view, as this view is set to a single entry model with the display name "Login as a different user"

we always want to show this.

sddm-theme/Login.qml
11

can you move the SDDM specific code here please.

sddm-theme/Main.qml
115

Why? If we're not showing the username prompt we won't be loading this component in the main view anyway.

Thanks for your comments. I should warn you that this is the second time I touch qml code, so apologies in advance :).

lookandfeel/contents/components/SessionManagementScreen.qml
60

ok

69

Hmm, the way I saw it, if showUserList is false (because there are more users than the threshold), the "Login as a different user" button is not visible, so there's no way to get the "Login as a different user" component on top of the stack view and so, there's no need for this to display anything.

But from your comment I assume userListView is used by kscreenlocker for something else, and that's the reason you said its visibility can't depend on the user threshold to disable avatars, is that correct?

sddm-theme/Login.qml
11

I can move it here if you think it's better to implement option 1 (see next comment) or if there's a way to change the visibility of userListView from here.

sddm-theme/Main.qml
115

Note that before I started working on all this I saw two ways to do this commit:

Option 1) Use the userPromptComponent (the "Login as different user" view), add buttons to suspend/reboot/shutdown, remove the "back" button which returns to the initial view , change the top put this view at the top of the stack, and cross my fingers so that if the userlist has visible: true but is not at the top of the stack, the avatars are not actually loaded.

Option 2) Use the userListComponent (the default view), making the showUsernamePrompt true, removing the "Login as different user" option (since it's basically the same). And that last part is what the line above does.

Option 1 means duplicating much code (the whole actionItems section) and I guess there's a way to extract that somewhere and reuse the actionItems section in both userPromptComponent and a new fullFeaturedUserPromptComponent, but I don't know that much QML to do that, so I choosed option 2. If you can spend some time explaining how to do it that way, I don't mind changing that.

antlarr updated this revision to Diff 6968.Sep 28 2016, 7:57 AM
  • Move logic to show/hide avatars from components/SessionManagementScreen.qml to Main.qml
davidedmundson accepted this revision.Sep 28 2016, 10:05 AM
davidedmundson added a reviewer: davidedmundson.
This revision is now accepted and ready to land.Sep 28 2016, 10:05 AM
This revision was automatically updated to reflect the committed changes.

I just updated and now my login screen is broken (sddm 0.13):

file:///usr/share/sddm/themes/breeze/Main.qml:87 Cannot assign to non-existent property "showUserList"
sddm-theme/Main.qml
87

This property does not exist in Login breaking the login screen!

This is in Plasma/5.8, so if it is a problem we need to do some emergency panicking, but as far as I can see it's fine?

sddm-theme/Main.qml
87

It does? components/SessionManagementScreen which is a superclass of Login.

I think the problem is

import "components"

so it uses the Login from components which does not have that because it looks up imports first before looking in the current directory. Importing "components" under a namespace fixes it for me.

there is no Login in components.

only:
ActionButton.qml artwork Battery.qml Clock.qml KeyboardLayoutButton.qml SessionManagementScreen.qml UserDelegate.qml UserList.qml

I think you might be trying to install onto 5.7 without clearing the old files?

Ok, now I feel stupid. But I was in adrenaline panicky release blocker mode. I reinstalled all the things from scratch and it works. Meh :( I wanted to be the hero of the day! :D