-
- Downloads
Don't allow deleting a ghost user.
- Add a `destroy_user` ability. This didn't exist before, and was implicit in other abilities (only admins could access the admin area, so only they could destroy all users; a user can only access their own account page, and so can destroy only themselves). - Grant this ability to admins, and when the current user is trying to destroy themselves. Disallow destroying ghost users in all cases. - Modify the `Users::DestroyService` to check this ability. Also check it in views to decide whether or not to show the "Delete User" button. - Add a short summary of the Ghost User to the bio.
Showing
- app/models/user.rb 3 additions, 1 deletionapp/models/user.rb
- app/policies/user_policy.rb 8 additions, 0 deletionsapp/policies/user_policy.rb
- app/services/users/destroy_service.rb 1 addition, 1 deletionapp/services/users/destroy_service.rb
- app/views/admin/users/_user.html.haml 1 addition, 1 deletionapp/views/admin/users/_user.html.haml
- app/views/admin/users/show.html.haml 4 additions, 1 deletionapp/views/admin/users/show.html.haml
- app/views/profiles/accounts/show.html.haml 4 additions, 1 deletionapp/views/profiles/accounts/show.html.haml
- spec/factories/users.rb 1 addition, 0 deletionsspec/factories/users.rb
- spec/policies/user_policy_spec.rb 37 additions, 0 deletionsspec/policies/user_policy_spec.rb
spec/policies/user_policy_spec.rb
0 → 100644
Please register or sign in to comment