Module: ChefFixie

Defined in:
lib/chef_fixie_shahid/context.rb,
lib/chef_fixie_shahid/sql.rb,
lib/chef_fixie_shahid/config.rb,
lib/chef_fixie_shahid/console.rb,
lib/chef_fixie_shahid/version.rb,
lib/chef_fixie_shahid/sql_objects.rb,
lib/chef_fixie_shahid/authz_mapper.rb,
lib/chef_fixie_shahid/authz_objects.rb,
lib/chef_fixie_shahid/utility_helpers.rb,
lib/chef_fixie_shahid/bulk_edit_permissions.rb,
lib/chef_fixie_shahid/check_org_associations.rb

Overview

Copyright © 2015 Chef Software Inc.

License

Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: Mark Anderson <[email protected]>

Much of this code was orginally derived from the orgmapper tool, which had many varied authors.

Defined Under Namespace

Modules: AuthzActorMixin, AuthzContainerMixin, AuthzGroupMixin, AuthzMapper, AuthzObjectMixin, AuthzUtils, BulkEditPermissions, CheckOrgAssociations, Console, Context, Sql, UtilityHelpers Classes: AuthzApi, Config

Constant Summary collapse

VERSION =
"0.5.2"

Class Method Summary collapse

Class Method Details

.configure {|Config.instance| ... } ⇒ Object

Yields:



27
28
29
# File 'lib/chef_fixie_shahid/config.rb', line 27

def self.configure
  yield Config.instance
end

.load_config(config_file = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/chef_fixie_shahid/config.rb', line 31

def self.load_config(config_file = nil)
  if config_file
    puts "loading config: #{config_file}..." if ChefFixie::Console.started_from_command_line?
    Kernel.load(config_file)
  else
    path = "/etc/opscode"
    puts "loading config from #{path}" if ChefFixie::Console.started_from_command_line?
    ChefFixie::Config.instance.load_from_pc(path)
  end
end

.setupObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/chef_fixie_shahid/config.rb', line 42

def self.setup
  # TODO: do we have to polute global object with this to make it available to the irb instance?
  Object.const_set(:ORGS, ChefFixie::Sql::Orgs.new)
  Object.const_set(:USERS, ChefFixie::Sql::Users.new)
  Object.const_set(:ASSOCS, ChefFixie::Sql::Associations.new)
  Object.const_set(:INVITES, ChefFixie::Sql::Invites.new)

  # scope this by the global org id?
  Object.const_set(:GLOBAL_GROUPS, ChefFixie::Sql::Groups.new.by_org_id(ChefFixie::Sql::Orgs::GlobalOrg))
  Object.const_set(:GLOBAL_CONTAINERS, ChefFixie::Sql::Containers.new.by_org_id(ChefFixie::Sql::Orgs::GlobalOrg))
end