1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-13 23:48:55 +01:00

(feat) members cannot see training deactivated in the list

This commit is contained in:
Du Peng 2024-12-12 14:17:49 +01:00
parent adeb3acd79
commit 362cdc4fc4
3 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@
## Next release ## Next release
- Improvement: default order for the spaces/trainings list is set to descending by created_at - 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 ## v6.3.35 2024 November 13

View File

@ -14,6 +14,7 @@ class API::TrainingsController < API::APIController
def show def show
@training = Training.friendly.find(params[:id]) @training = Training.friendly.find(params[:id])
authorize @training
end end
def create def create

View File

@ -8,6 +8,10 @@ class TrainingPolicy < ApplicationPolicy
end end
end end
def show?
!record.disabled? || user.admin? || user.manager?
end
def create? def create?
user.admin? user.admin?
end end