Usage of Cancancan_accessible_by_action -- removed #331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Nahradil jsem používání
folio_records.accessible_by(current_ability, self.class.cancancan_accessible_by_action)
zafolio_records.accessible_by(current_ability)
, což při použitíload_and_authorize_resource
je totéž jakofolio_records
.Tj. načítají se záznamy povolené uživateli pro danou akci controlleru.
Pokud je tam nějaká specifická mimo CRUD, je potřeba ji nastavit v abilitách.
Některé helpery pro consoli jsem upravil tak, aby si sami kontrolovali, jestli na danou akci má uživatel právo či nikoliv.
A podle toho buď zobrazili input nebo jen read-only input.
Např u
published_toggle
se místo toggle zobrazí jen "Ano" nebo "Ne", pokud nemáte právo to měnit.U zatržítek se input zobrazí, ale je disabled.
Pro "sorting" je potřeba mít právo :update. A právo na
set_xxx_positions
pro patřičný model (podle metody volané skrz XHR)