module RsUserPolicy::UserAssignments::UserAssignments

Public Instance Methods

[](email) click to toggle source

Returns a hash which represents the user specified by the email address specified If the user does not exist the (see add_user) method will be called and the user will be created.

@param [String] email The email address of the user to fetch

@return [Hash] A hash of key/value pairs to be passed to the RightScale API for Users#create. This will also include a “roles” key, and may also include any other keys returned by the source

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 75
def [](email)
  raise NotImplementedError, "Please implement this in your concrete class"
end
add_user(email, options={}) click to toggle source

Adds a user to user_assignments. If the user already exists the existing record will be returned. Otherwise the user will be created with a single role of “immutable”

@param [String] email The email address of the user to create or return @param [Hash] options Hash of property key/value pairs for the user. The following options are known, but there can be any key in thi hash @option options [Array<String>] “roles” An array of role names for the user

@return [Hash] The added or existing user where they key is the users email, and the value is a hash of key/value pairs of user properties.

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 87
def add_user(email, options={})
  raise NotImplementedError, "Please implement this in your concrete class"
end
delete(email) click to toggle source

Deletes a user from the user assignments

@param [String] email The email address for the user

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 55
def delete(email)
  raise NotImplementedError, "Please implement this in your concrete class"
end
get_roles(email) click to toggle source

Returns the roles assigned to the user. If the user does not exist they should be automatically created with the role “immutable”

@param [String] email The email address for the user

@return [Array<String>] The roles assigned to the user

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 48
def get_roles(email)
  raise NotImplementedError, "Please implement this in your concrete class"
end
length() click to toggle source

@return [Int] The number of users in the user assignments object

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 33
def length
  raise NotImplementedError, "Please implement this in your concrete class"
end
list() click to toggle source

Returns a list of all user emails which have a user assignment in the source

@return [Array<String>] An array of email addresses for users with a user assignment

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 28
def list
  raise NotImplementedError, "Please implement this in your concrete class"
end
serialize(options={}) click to toggle source

Commits any changes made to the UserAssignments object back to it’s original data store. This is an opportunity to perform DB flushes or write back to a source file.

@param [Hash] options A hash of values which may be required to serialize

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 64
def serialize(options={})
  raise NotImplementedError, "Please implement this in your concrete class"
end
size() click to toggle source

@return [Int] The number of users in the user assignments object

# File lib/rs_user_policy/user_assignments/user_assignments.rb, line 38
def size
  raise NotImplementedError, "Please implement this in your concrete class"
end