Authorisation management using CanCanCan added

This commit is contained in:
Christoph Haas 2021-02-28 21:36:46 +01:00
parent 51be4a4777
commit 7a3b65fe50
24 changed files with 211 additions and 295 deletions

View file

@ -25,24 +25,13 @@
.text
= screenshot.caption
// Has the unmoderated screenshot been uploaded by the current user?
- if screenshot_uploaded_by_current_user?(screenshot)
- if current_user.screenshots.include?(screenshot)
.text
span.label.secondary
' Uploaded by you
- unless screenshot.approved
' (needs to be approved)
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
// Is the user an admin?
// or does the screenshot belong to the user (determined by session cookie)
- if current_user && current_user.is_admin?
hr
.text
span.label.secondary
= status_text(screenshot)
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
/ - elsif user_signed_in? and screenshot.user == current_user
/ = render(partial: 'user_dropdown', locals: {screenshot: screenshot})
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
// Second paginator at the bottom so the user does not have to scroll up again