Sha256: b96b619539bafccd0f76eaeaf757de9989c38f20fac11d5e9d20318b12ca5eb1
Contents?: true
Size: 652 Bytes
Versions: 11
Compression:
Stored size: 652 Bytes
Contents
class BookmarkPolicy < ApplicationPolicy def index? user.try(:has_role?, 'User') end def show? case user.try(:role).try(:name) when 'Administrator' true when 'Librarian' true when 'User' if record.user == user true elsif user.profile.try(:share_bookmarks) true else false end end end def create? user.try(:has_role?, 'User') end def update? case user.try(:role).try(:name) when 'Administrator' true when 'Librarian' true when 'User' true if record.user == user end end def destroy? update? end end
Version data entries
11 entries across 11 versions & 1 rubygems