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:
parent
adeb3acd79
commit
362cdc4fc4
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user