Module: Users::RJR

Includes:
Omega, Omega::Server::DSL, Users
Defined in:
lib/users/rjr/inspect.rb,
lib/users/rjr/get.rb,
lib/users/rjr/init.rb,
lib/users/rjr/state.rb,
lib/users/rjr/update.rb,
lib/users/rjr/events.rb,
lib/users/rjr/create.rb,
lib/users/rjr/session.rb,
lib/users/rjr/register.rb,
lib/users/rjr/attribute.rb,
lib/users/rjr/permissions.rb

Overview

users::add_role, users::add_privilege rjr definitions

Copyright (C) 2013 Mohammed Morsi <[email protected]> Licensed under the AGPLv3+ www.gnu.org/licenses/agpl.txt

Constant Summary collapse

GET_METHODS =
{ :get_entities => get_entities  }
STATE_METHODS =
{ :save_state => save_state, :restore_state => restore_state }
UPDATE_METHODS =
{ :update_user => update_user }
EVENTS_METHODS =
{ :subscribe_to     => subscribe_to,
:unsubscribe      => unsubscribe }
CREATE_METHODS =
{ :create_user => create_user,
:create_role => create_role}
SESSION_METHODS =
{ :login  => ,
:logout => logout}
INSPECT_METHODS =
{ :get_status => get_status }
REGISTER_METHODS =
{ :register => register,
:confirm_register => confirm_register }
ATTRIBUTE_METHODS =
{ :update_attribute  => update_attribute,
:has_attribute     => has_attribute }
PERMISSION_METHODS =
{ :add_role => add_role,
:remove_role => remove_role,
:add_privilege => add_privilege,
:remove_privilege => remove_privilege}

Config options collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Omega::Server::DSL

#check_attribute, #check_privilege, #cosmos_entity?, #current_session, #current_user, #delete_event_handler_for, #filter_properties, #filters_from_args, #from_valid_source?, #handle_node_closed, #in_subsystem, #is_cmd?, #is_node?, #login, #matching, #persistent_transport?, #remove_callbacks_for, #require_attribute, #require_persistent_transport!, #require_privilege, #require_state, #require_valid_source!, #subsystem, #subsystem_entity?, #subsystem_event?, #validate_session_source!, #with, #with_id

Methods included from Users

random_string

Class Attribute Details

.additional_usersObject

List of additional users to create


50
51
52
# File 'lib/users/rjr/init.rb', line 50

def additional_users
  @additional_users
end

.omega_urlObject

String URL of the omega server


38
39
40
# File 'lib/users/rjr/init.rb', line 38

def omega_url
  @omega_url
end

.permenant_usersObject

Array<String> Usernames to mark as permenant on creation


41
42
43
# File 'lib/users/rjr/init.rb', line 41

def permenant_users
  @permenant_users
end

.recaptcha_enabledObject

Boolean toggling if recaptchas are enabled / required for user registration


26
27
28
# File 'lib/users/rjr/init.rb', line 26

def recaptcha_enabled
  @recaptcha_enabled
end

.recaptcha_priv_keyObject

String recaptch private key


34
35
36
# File 'lib/users/rjr/init.rb', line 34

def recaptcha_priv_key
  @recaptcha_priv_key
end

.recaptcha_pub_keyObject

String recaptch public key


30
31
32
# File 'lib/users/rjr/init.rb', line 30

def recaptcha_pub_key
  @recaptcha_pub_key
end

.user_attrs_enabledObject

Boolean toggling if user attribute system is enabled / disabled. Disabling attributes will result in setting attributes having no effect and all has_attribute? calls returning true


22
23
24
# File 'lib/users/rjr/init.rb', line 22

def user_attrs_enabled
  @user_attrs_enabled
end

.users_rjr_passwordObject

Password to use to communicate w/ other modules over the local rjr node


47
48
49
# File 'lib/users/rjr/init.rb', line 47

def users_rjr_password
  @users_rjr_password
end

.users_rjr_usernameObject

User to use to communicate w/ other modules over the local rjr node


44
45
46
# File 'lib/users/rjr/init.rb', line 44

def users_rjr_username
  @users_rjr_username
end

Class Method Details

.nodeObject


80
81
82
# File 'lib/users/rjr/init.rb', line 80

def self.node
  @node ||= ::RJR::Nodes::Local.new :node_id => self.user.id
end

.registryObject


88
89
90
# File 'lib/users/rjr/init.rb', line 88

def self.registry
  @registry ||= Users::Registry.new
end

.resetObject


96
97
98
# File 'lib/users/rjr/init.rb', line 96

def self.reset
  Users::RJR.registry.clear!
end

.set_config(config) ⇒ Object

Set config options using Omega::Config instance


58
59
60
61
62
63
64
65
66
67
68
# File 'lib/users/rjr/init.rb', line 58

def self.set_config(config)
  self.user_attrs_enabled = config.user_attrs_enabled
  self.recaptcha_enabled  = config.recaptcha_enabled
  self.recaptcha_pub_key  = config.recaptcha_pub_key
  self.recaptcha_priv_key = config.recaptcha_priv_key
  self.omega_url          = config.omega_url
  self.permenant_users    = config.permenant_users
  self.users_rjr_username = config.users_rjr_user
  self.users_rjr_password = config.users_rjr_pass
  self.additional_users   = config.additional_users
end

.userObject


70
71
72
73
74
# File 'lib/users/rjr/init.rb', line 70

def self.user
  @user ||= Users::User.new(:id       => Users::RJR::users_rjr_username,
                            :password => Users::RJR::users_rjr_password,
                            :registration_code => nil)
end

Instance Method Details

#nodeObject


84
85
86
# File 'lib/users/rjr/init.rb', line 84

def node
  Users::RJR.node
end

#registryObject


92
93
94
# File 'lib/users/rjr/init.rb', line 92

def registry
  Users::RJR.registry
end

#userObject


76
77
78
# File 'lib/users/rjr/init.rb', line 76

def user
  Users::RJR.user
end