Sha256: fa99190ce89acb6d98855948641cc0df6efe1436e1673c25d93f3fb24ba86b49
Contents?: true
Size: 609 Bytes
Versions: 39
Compression:
Stored size: 609 Bytes
Contents
class PictureFilePolicy < ApplicationPolicy def index? true end def show? case user.try(:role).try(:name) when 'Librarian' true when 'User' true if record.picture_attachable.try(:required_role_id).to_i <= 2 else true if record.picture_attachable.try(:required_role_id).to_i <= 1 end end def create? true if user.try(:has_role?, 'Librarian') end def edit? true if user.try(:has_role?, 'Librarian') end def update? true if user.try(:has_role?, 'Librarian') end def destroy? true if user.try(:has_role?, 'Librarian') end end
Version data entries
39 entries across 38 versions & 2 rubygems