lib/maestrano.rb in maestrano-0.4.0 vs lib/maestrano.rb in maestrano-0.5.0
- old
+ new
@@ -59,9 +59,28 @@
self.config ||= Configuration.new
yield(config)
self.config.api_token = "#{self.config.app_id}:#{self.config.api_key}"
end
+ # Check that app_id and api_key passed
+ # in argument match
+ def self.authenticate(app_id,api_key)
+ self.param(:app_id) == app_id && self.param(:api_key) == api_key
+ end
+
+ def self.mask_user(user_uid,group_uid)
+ sanitized_user_uid = self.unmask_user(user_uid)
+ if Maestrano.param('user_creation_mode') == 'virtual'
+ return "#{sanitized_user_uid}.#{group_uid}"
+ else
+ return sanitized_user_uid
+ end
+ end
+
+ def self.unmask_user(user_uid)
+ user_uid.split(".").first
+ end
+
# Get configuration parameter value
# E.g:
# Maestrano.param('api_key')
# Maestrano.param(:api_key)
def self.param(parameter)
\ No newline at end of file