Sha256: 4d5456b5d7bb85fd300d30367ff338b2e2e220c8d94cbb6f04d46b4de7f275f0
Contents?: true
Size: 857 Bytes
Versions: 9
Compression:
Stored size: 857 Bytes
Contents
# encoding: UTF-8 require 'securerandom' module Spontaneous module Permissions autoload :UserLevel, "spontaneous/permissions/user_level" autoload :User, "spontaneous/permissions/user" autoload :AccessGroup, "spontaneous/permissions/access_group" autoload :AccessKey, "spontaneous/permissions/access_key" class << self # Convenience shortcut so we can do Permissions[:root] def [](level_name) UserLevel[level_name] end def root UserLevel.root end def has_level?(user, level) return true unless user user.level >= level end def random_string(length) SecureRandom.urlsafe_base64(length)[0...(length)] end def crypto_hash(string, algorithm = Digest::SHA1) algorithm.new.update(string).hexdigest end end end end
Version data entries
9 entries across 9 versions & 1 rubygems