Sha256: eb78546ac69334f27c4506ec05b71bfe0bc13f8e25c2567aca206a705fabb5fc

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

module Cbac
  # Class performs various functions specific to the CBAC system itself. Most
  # important function is to check if the system is initialized; without proper
  # initialization, the bootstrapper will crash.
  class Setup
    class << self

      # Check to see if the tables are correctly migrated. If the tables are not
      # migrated, CBAC should terminate immediately.
      def check_tables
        return false unless Cbac::PrivilegeSetRecord.table_exists?
        return false unless Cbac::GenericRole.table_exists?
        return false unless Cbac::Membership.table_exists?
        return false unless Cbac::Permission.table_exists?
        true
      end

      # Checks if the system is properly setup. This method is used by the
      # bootstrapper to see if the system should be initialized. If the system
      # is not properly setup, the bootstrapper will crash. Checks are performed
      # to see if all the tables exists.
      def check
        if check_tables == false
          puts "CBAC: not properly initialized: one or more tables are missing. Did you install it correctly? (run generate)"
          return false
        end
        true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cbac-0.5.4 lib/cbac/setup.rb
cbac-0.5.3 lib/cbac/setup.rb
cbac-0.5.2 lib/cbac/setup.rb
cbac-0.5.1 lib/cbac/setup.rb
cbac-0.3.1 lib/cbac/setup.rb