Sha256: f15387da1af4c00bc2200d1c7306c9bb624e1b4e69017016b7e229db9a494a26
Contents?: true
Size: 805 Bytes
Versions: 16
Compression:
Stored size: 805 Bytes
Contents
class Ability include CanCan::Ability def initialize(user) user ||= User.new can :manage, Query, Query.with_role(user.role) do |query| query.roles.include?(user.role) end can :manage, Alert, Alert.with_role(user.role) do |alert| alert.query.roles.include?(user.role) end can :manage, QueryVersion, QueryVersion.with_role(user.role) do |query_version| query_version.query.roles.include?(user.role) end can :manage, Result, Result.with_role(user.role) do |result| if result.query result.query.roles.include?(user.role) else user == result.owner end end can :manage, Visualization, Visualization.with_role(user.role) do |visualization| visualization.query.roles.include?(user.role) end end end
Version data entries
16 entries across 16 versions & 1 rubygems