class Blufin::SiteAuth
Constants
- ACCOUNT
- ACCOUNT_PRIVILEGES
- AUTHENTICATION_LEVELS
- CLIENT
- CONFIG_COMMON
- CRON
- DB
- DB_CONFIGURATION
- DB_CONFIGURATION_PROPERTY
- INTERNAL
- INTERNAL_ACCOUNT
- INTERNAL_ACCOUNT_USER
- LEVEL_ACCOUNT
- LEVEL_ACCOUNT_USER
- LEVEL_NONE
- OAUTH_ACCOUNT
- OAUTH_ACCOUNT_USER
- PROFILE
- PROFILE_API
- PROFILE_CRON
- PROFILE_WORKER
- PROJECT
- THIRD_PARTY_APPLICATION
- THIRD_PARTY_APPLICATION_PRIVILEGES
- THIRD_PARTY_DEVELOPER
- USER
- USER_PRIVILEGES
Public Class Methods
get_auth_level()
click to toggle source
Gets the Authorization Level. @return String
# File lib/core/site/site_auth.rb, line 54 def self.get_auth_level @auth_level end
get_auth_level_for_table(schema, table)
click to toggle source
Returns 1 of 3 values -> NONE, ACCOUNT
, ACCOUNT_USER. From this value you should be able to determine what level of Authentication is required depending on the context you're in at that point. Doesn't need to be aware of what site it's on as this is all hard-coded generator logic. @return String
# File lib/core/site/site_auth.rb, line 62 def self.get_auth_level_for_table(schema, table) raise RuntimeError, "Invalid @auth_level: #{@auth_level}" unless AUTHENTICATION_LEVELS.keys.include?(@auth_level) case schema when Blufin::YmlSchemaValidator::APP if [USER, USER_PRIVILEGES].include?(table) return LEVEL_ACCOUNT else return [INTERNAL_ACCOUNT_USER, OAUTH_ACCOUNT_USER].include?(@auth_level) ? LEVEL_ACCOUNT_USER : LEVEL_ACCOUNT end when Blufin::YmlSchemaValidator::CONFIG return LEVEL_NONE when Blufin::YmlSchemaValidator::COMMON [ACCOUNT, ACCOUNT_PRIVILEGES, THIRD_PARTY_DEVELOPER, THIRD_PARTY_APPLICATION, THIRD_PARTY_APPLICATION_PRIVILEGES].include?(table) ? LEVEL_NONE : LEVEL_ACCOUNT when Blufin::YmlSchemaValidator::MOCK return LEVEL_ACCOUNT_USER else raise RuntimeError, "Unrecognized schema: #{schema}" end end
init(auth_level)
click to toggle source
Handles all the logic revolved around the different Auth Levels. Only needs to be initialized once. @return void
# File lib/core/site/site_auth.rb, line 48 def self.init(auth_level) @auth_level = auth_level end