Chicken and egg problem - Scope and syncing #657
-
I have set up syncing and mapping of groups to local roles and a scope including only the relevant access groups to only include users with access in syncing. Have I configured something wrong when |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I wouldn't set up a scope to prevent users from logging into your application that must have certain groups/roles. I would use an authentication rule for that: https://ldaprecord.com/docs/laravel/v3/auth/database/configuration/#rules This way you can keep users in sync, and when the relevant groups/roles are added, they can immediately be allowed to authenticate.
The delete missing flag requires that your Eloquent user model has |
Beta Was this translation helpful? Give feedback.
-
I don't think I agree with this in general. For a widely available application, yes, it could make sense to have all (relevant) users synced in. For an application with restricted availability however I belive only users with correct group membership should be synced (reducing slightly the attack surface). I have set up a rule for specific groups but I also want the synchronization to limit synchronizing to members of the same groups for this restricted application.
No, I had not. The reason for this is that soft deleting is bad practice in terms of privacy. It is not considered sufficient to have privacy information soft deleted, it must be physically deleted. In this case however, with user information being synchronize, for security reasons (reducing effect of mistakes) it makes sense. In this case I could use soft deletes and then have a job which physically deletes the user after a specific time. May be you could add an option for this? I have now enables soft delete and it works fine with the ... |
Beta Was this translation helpful? Give feedback.
Ok, then the
--delete-missing
option is what you're looking for.Use Laravel's model pruning feature to take care of this -- it doesn't need to be baked into LdapRecord-Laravel:
https://laravel.com/docs/10.x/eloquent#pruning-models