Class: Insights::API::Common::RBAC::Seed

Inherits:
Object
  • Object
show all
Defined in:
lib/insights/api/common/rbac/seed.rb

Instance Method Summary collapse

Constructor Details

#initialize(seed_file, user_file = nil) ⇒ Seed

Returns a new instance of Seed.



8
9
10
11
# File 'lib/insights/api/common/rbac/seed.rb', line 8

def initialize(seed_file, user_file = nil)
  @acl_data = YAML.load_file(seed_file)
  @request = Insights::API::Common::Request.current || create_request(user_file)
end

Instance Method Details

#processObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/insights/api/common/rbac/seed.rb', line 13

def process
  Insights::API::Common::Request.with_request(@request) do
    begin
      create_groups
      create_roles
      add_roles_to_groups
    rescue RBACApiClient::ApiError => e
      Rails.logger.error("Exception when RBACApiClient::ApiError : #{e}")
      raise
    end
  end
end