Skip to content

Commit

Permalink
(feat) members cannot see training deactivated in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Dec 12, 2024
1 parent adeb3ac commit 362cdc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next release

- Improvement: default order for the spaces/trainings list is set to descending by created_at
- Improvement: members cannot see training deactivated in the list

## v6.3.35 2024 November 13

Expand Down
1 change: 1 addition & 0 deletions app/controllers/api/trainings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def index

def show
@training = Training.friendly.find(params[:id])
authorize @training
end

def create
Expand Down
4 changes: 4 additions & 0 deletions app/policies/training_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def resolve
end
end

def show?
!record.disabled? || user.admin? || user.manager?
end

def create?
user.admin?
end
Expand Down

0 comments on commit 362cdc4

Please sign in to comment.