Sha256: 49923b9449037034a35a5763afa629fcdad3dbe407cddf8d0cbc299d7a5a8cb1
Contents?: true
Size: 843 Bytes
Versions: 37
Compression:
Stored size: 843 Bytes
Contents
module Gritano class Permission < ActiveRecord::Base belongs_to :user belongs_to :repository READ = 1 WRITE = 2 def add_access(access) if access == :read self.access = READ | (self.access || 0) elsif access == :write self.access = WRITE | (self.access || 0) else return false end return true end def remove_access(access) if access == :read self.access = (self.access || 0) & (~ READ) elsif access == :write self.access = (self.access || 0) & (~ WRITE) else return false end return true end def is(access) if access == :read return (self.access & READ) == READ elsif access == :write return (self.access & WRITE) == WRITE end end end end
Version data entries
37 entries across 37 versions & 1 rubygems