Module: Ruolo

Defined in:
lib/ruolo.rb,
lib/ruolo/sync.rb,
lib/ruolo/version.rb,
lib/ruolo/models/role.rb,
lib/ruolo/models/user.rb,
lib/ruolo/configuration.rb,
lib/ruolo/models/permission.rb

Overview

Copyright 2019 Mario Finelli

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.

Defined Under Namespace

Modules: Models Classes: Configuration, Sync

Constant Summary collapse

VERSION =
'0.4.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationRuolo::Configuration

Get the current configuration.

Returns:



30
31
32
# File 'lib/ruolo.rb', line 30

def self.configuration
  @configuration ||= Ruolo::Configuration.new
end

Class Method Details

.configure {|comfig| ... } ⇒ Object

Gives a block with which to configure.

Yield Parameters:

Yield Returns:

  • (void)


45
46
47
# File 'lib/ruolo.rb', line 45

def self.configure
  yield(configuration)
end

.resetvoid

This method returns an undefined value.

Reset the current configuration to the defaults.



37
38
39
# File 'lib/ruolo.rb', line 37

def self.reset
  @configuration = Ruolo::Configuration.new
end

.synchronize!(policy_file) ⇒ void

This method returns an undefined value.

Given a policy file synchronize the roles and permissions in the database.

Parameters:

  • policy_file (String)

    path to a yaml policy file



53
54
55
# File 'lib/ruolo.rb', line 53

def self.synchronize!(policy_file)
  Ruolo::Sync.new(policy_file).sync!
end