zorn-v / nextcloud-social-login

GNU Affero General Public License v3.0
198 stars 137 forks source link

Create users with disabled account #370

Closed Hugues1337 closed 1 year ago

Hugues1337 commented 1 year ago

Hello,

Issue: If the option "Create users with disabled account" is activated, each new user is disabled, as expected. But if I enable a user, the "/files" folder is not created and he can't log in.

Solution:

What I want: Keep the option active, and when I activate a user the directory "/files" is created.

Nextcloud version (docker): 23.0.7 Social version: 4.16.2

Thanks; Hugues

zorn-v commented 1 year ago

What are you talking about ? /files dir created every time while user log in https://github.com/zorn-v/nextcloud-social-login/blob/ceb6eef327c2ae190ddfcc7509b35f9a78f0acc8/lib/Service/ProviderService.php#L589-L590

Besides, I just check your flow, and all works fine.

May be you have some "permission issue" and php process just have no rights to write in NC data dir ?

Hugues1337 commented 1 year ago

If I deactivate the "Create users with disabled account" option it works, I have my /files directory. If I re-enable the option, the directory is not created. So no "permission issue" here (I guess!).

I tested both scenario with a fresh account.

That's why I thought the problem was in the "social login" module, and not in the nextcloud installation.

zorn-v commented 1 year ago

It created while user logs in, not when you "enable" user.

zorn-v commented 1 year ago

I differently not understand you problem. Can you tell something like:

  1. I disable new accounts
  2. Create account with some external service.
  3. Enable that account
  4. That account can not log in because SOME ERROR (exact text will be fine).
zorn-v commented 1 year ago

Does not overthink about folders etc. Just give error text.

zorn-v commented 1 year ago

Or maybe you just unsatisfied that files folder does not created when you enable user ? Sorry, I does not relate on it. If you want, you can subscribe to some event (have no idea how it names), and doing something like that https://github.com/zorn-v/nextcloud-social-login/issues/370#issuecomment-1219022745

Hugues1337 commented 1 year ago

It created while user logs in, not when you "enable" user.

The User directory is created (/data/google-[id]) if the option is activated or not. However the directory /data/google-[id]/files is not created if I enable the option.

I differently not understand you problem. Can you tell something like:

1. I disable new accounts

2. Create account with some external service.

3. Enable that account

4. That account can not log in because SOME ERROR (exact text will be fine).
  1. I activate the "Create users with disabled account" option
  2. a new user connects
  3. he has this error : image
  4. I activate the user
  5. the user tries to connect again but has this new error image
  6. I check its directory, and the directory /data/google-[id]/files is missing. If I create it manually the user can connect.

Or maybe you just unsatisfied that files folder does not created when you enable user ? Sorry, I does not relate on it. If you want, you can subscribe to some event (have no idea how it names), and doing something like that #370 (comment)

This is exactly my problem. Yes, I can dig this solution if you think it's the best solution. Thank you.

zorn-v commented 1 year ago

First, try to update NC to version 24 (as I check on it). This "workaround" is "old" enough (https://github.com/zorn-v/nextcloud-social-login/commit/d00c38e51eb4973eac179ad8bbe13ad5f4821326), but maybe some changes was made in v23 and then reverted. Also it'll be good to see some related logs (data/nextcloud.log).

zorn-v commented 1 year ago

Possibly it just do not reach code that create that dir BTW. I need logs :wink: