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

Persist the config changes of usermanagement #23333

Closed

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Oct 10, 2020

Persist the changes made to usermanagemnt like:

  • Show Languages
  • Show last login
  • Show user backend
  • Show storage path

Signed-off-by: Sujith Haridasan sujith.h@gmail.com

@sharidas sharidas linked an issue Oct 10, 2020 that may be closed by this pull request
@sharidas sharidas self-assigned this Oct 10, 2020
@sharidas sharidas added the 2. developing Work in progress label Oct 10, 2020
@sharidas
Copy link
Contributor Author

Summary

In the user management page, the settings to show languages, last login etc were not saved in the db.

Description

The idea behind this PR is to save the changes made to settings in the user management page for:

  • Show Languages
  • Show last login
  • Show user backend
  • Show store path

The only option that was being saved was Send email to new user. And hence prior to this change set the changes made by the user were lost after relogin. This change set however would help the user regain the configuration which was set.

How was it tested?

  • Create admin user
  • Enable/Disable any of the options like Show Languages, Show last login, Show user backend, Show storage path
  • Relogin again to see if these options are same as before.
  • It worked as expected.

@sharidas sharidas force-pushed the save-config-user-management branch 2 times, most recently from e30d8a4 to fa8a6c6 Compare October 10, 2020 13:20
@sharidas sharidas added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 10, 2020
@sharidas sharidas requested review from skjnldsv, ChristophWurst and schiessle and removed request for skjnldsv and ChristophWurst October 10, 2020 16:04
@sharidas sharidas force-pushed the save-config-user-management branch 2 times, most recently from a0dfe4a to b74add5 Compare October 12, 2020 12:25
@sharidas
Copy link
Contributor Author

make build-js-production looks clean in my instance. The files mentioned in Node / 12.x github action are already updated in the PR. Not sure what is causing the failure for Node / 12.x...

@skjnldsv
Copy link
Member

make build-js-production looks clean in my instance. The files mentioned in Node / 12.x github action are already updated in the PR. Not sure what is causing the failure for Node / 12.x...

do you npm install or npm ci ?
You need to use npm ci

@sharidas
Copy link
Contributor Author

make build-js-production looks clean in my instance. The files mentioned in Node / 12.x github action are already updated in the PR. Not sure what is causing the failure for Node / 12.x...

do you npm install or npm ci ?
You need to use npm ci

Yah I did. Here is the log captured from my console:

nextcloud2 git:(save-config-user-management) ✗ npm ci       
npm WARN prepare removing existing node_modules/ before installation

> fsevents@1.2.13 install /home/sujith/test/nextcloud2/node_modules/fsevents
> node install.js


Skipping 'fsevents' build as platform linux is not supported

> core-js@3.6.5 postinstall /home/sujith/test/nextcloud2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@2.6.11 postinstall /home/sujith/test/nextcloud2/node_modules/@babel/polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.4 postinstall /home/sujith/test/nextcloud2/node_modules/@nextcloud/moment/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/sujith/test/nextcloud2/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> node-sass@4.14.1 install /home/sujith/test/nextcloud2/node_modules/node-sass
> node scripts/install.js

Cached binary found at /home/sujith/.npm/_cacache/node-sass/4.14.1/linux-x64-72_binding.node

> node-sass@4.14.1 postinstall /home/sujith/test/nextcloud2/node_modules/node-sass
> node scripts/build.js

Binary found at /home/sujith/test/nextcloud2/node_modules/node-sass/vendor/linux-x64-72/binding.node
Testing binary
Binary is fine

> core-js@2.6.11 postinstall /home/sujith/test/nextcloud2/node_modules/@babel/runtime-corejs2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> nodent-runtime@3.2.1 install /home/sujith/test/nextcloud2/node_modules/nodent-runtime
> node build.js

## Built /home/sujith/test/nextcloud2/node_modules/nodent-runtime/dist/index.js
added 1157 packages in 9.404s
➜  nextcloud2 git:(save-config-user-management) ✗

Persist the changes made to usermanagemnt like:
- Show Languages
- Show last login
- Show user backend
- Show storage path

Signed-off-by: Sujith Haridasan <sujith.h@gmail.com>
@skjnldsv
Copy link
Member

skjnldsv commented Nov 3, 2020

What is the status here? :)

@sharidas
Copy link
Contributor Author

sharidas commented Nov 4, 2020

What is the status here? :)

I have updated the changes requested :) The conflicts need to be resolved in the branch...

@skjnldsv
Copy link
Member

skjnldsv commented Nov 4, 2020

Please rebase to master :)
You can drop the compiled files conflicts

@@ -260,6 +260,10 @@ public function usersList() {
$serverData['newUserGenerateUserID'] = $this->config->getAppValue('core', 'newUser.generateUserID', 'no') === 'yes';
$serverData['newUserRequireEmail'] = $this->config->getAppValue('core', 'newUser.requireEmail', 'no') === 'yes';
$serverData['newUserSendEmail'] = $this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes';
$serverData['showLastLogin'] = $this->config->getAppValue('core', 'users-showlastlogin', 'no') === 'yes';
Copy link
Member

@juliushaertl juliushaertl Nov 4, 2020

Choose a reason for hiding this comment

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

I'd prefer to have those stored in the 'settings' app instead of 'core', the other one make sense for core since core sends out the email and generates the user id, but the show* settings are really only settings app relevant.

if (!in_array($key, $allowed, true)) {
return new JSONResponse([], Http::STATUS_FORBIDDEN);
}

$this->config->setAppValue('core', $key, $value);
$this->config->setAppValue('core', 'users-'.$key, $value);
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we could introduce them as user values so that each admin user has their own setting for 'showlastlogin', 'showlanguages', 'showuserbackend', 'showstoragepath' using setUserValue instead

Copy link
Member

Choose a reason for hiding this comment

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

Also wouldn't this basically break the existing newUser.sendMail setting since the key would now be prefixed with 'users-' ?

Copy link
Member

@juliushaertl juliushaertl left a comment

Choose a reason for hiding this comment

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

See inline 😉

This was referenced Dec 14, 2020
This was referenced Dec 28, 2020
@MorrisJobke MorrisJobke modified the milestones: Nextcloud 21, Nextcloud 22 Jan 7, 2021
@J0WI
Copy link
Contributor

J0WI commented Apr 28, 2021

🏓 @sharidas

This was referenced May 20, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
@blizzz blizzz modified the milestones: Nextcloud 22, Nextcloud 23 Jun 2, 2021
@skjnldsv skjnldsv mentioned this pull request Oct 13, 2021
@skjnldsv
Copy link
Member

As there is no feedback since a while I will close this PR. If you are still willing to get this in, please address the potential comments and rebase to latest master. Then, feel free to re-open.

@skjnldsv skjnldsv closed this Oct 13, 2021
@skjnldsv skjnldsv removed this from the Nextcloud 23 milestone Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Management settings not saved on logout
8 participants