Sha256: 8e7ff02cec42421e3d739ee214c74f6b9c70dec2e1cedbab11a1b3c13bef93d2
Contents?: true
Size: 956 Bytes
Versions: 18
Compression:
Stored size: 956 Bytes
Contents
# encoding: UTF-8 module Spontaneous::Permissions class AccessGroup < Sequel::Model(:spontaneous_groups) many_to_many :members, :class => :'Spontaneous::Permissions::User', :join_table => :spontaneous_groups_users, :left_key => :group_id, :right_key => :user_id def level_for(content) if selector.matches(content) level else UserLevel.none end end def selector @selector ||= Spontaneous::ContentQuery.new(access_selector) end def level_for(content) if selector.matches?(content) level else UserLevel.none end end def level if disabled UserLevel.none else UserLevel[level_name] end end def level=(level) self.level_name = level.to_s end def invisible? !user_id.blank? end def validate super errors.add(:name, 'is required') if name.blank? end end end
Version data entries
18 entries across 18 versions & 1 rubygems