molten-trunk/molten5_withgrid/app/models/sfcontact.rb
def privilege?(privilege_type)
    admin_chain = AppConstants::PRIVILEGE.values.reject { |p| p == AppConstants::PRIVILEGE[:inactive] }
    support_admin_chain = admin_chain.reject { |p| p == AppConstants::PRIVILEGE[:admin] }
    super_user_chain = support_admin_chain.reject do |p|
      [ AppConstants::PRIVILEGE[:marketing_admin], 
        AppConstants::PRIVILEGE[:support_admin], 
      ].include?(p)
    end
    member_chain = super_user_chain.reject { |p| p == AppConstants::PRIVILEGE[:super_user] }
    
    case portal_privilege
    when AppConstants::PRIVILEGE[:admin]
      admin_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:support_admin]
      support_admin_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:user_manager]
      super_user_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:super_user]
      super_user_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:member]
      member_chain.include?(privilege_type)
    end
  end
# Determines if the contact has the specified privileges. 
# Privileges (from lowest to highest):
#   - Member
#   - Super User
#   - User Manager
#   - Support Admin
#   - Admin
Determines if the contact has the specified privileges.
Privileges (from lowest to highest):
Member
Super User
User Manager
Support Admin
Admin
Determines if the contact has the specified privileges . Privileges ( from lowest to highest ) : Member Super User User Manager Support Admin Admin
def privilege?(privilege_type)
    admin_chain = AppConstants::PRIVILEGE.values.reject { |p| p == AppConstants::PRIVILEGE[:inactive] }
    support_admin_chain = admin_chain.reject { |p| p == AppConstants::PRIVILEGE[:admin] }
    super_user_chain = support_admin_chain.reject do |p|
      [ AppConstants::PRIVILEGE[:marketing_admin], 
        AppConstants::PRIVILEGE[:support_admin], 
      ].include?(p)
    end
    member_chain = super_user_chain.reject { |p| p == AppConstants::PRIVILEGE[:super_user] }
    case portal_privilege
    when AppConstants::PRIVILEGE[:admin]
      admin_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:support_admin]
      support_admin_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:user_manager]
      super_user_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:super_user]
      super_user_chain.include?(privilege_type)
    when AppConstants::PRIVILEGE[:member]
      member_chain.include?(privilege_type)
    end
  end
def privilege? ( privilege_type ) admin_chain = AppConstants :: PRIVILEGE . values . reject { | p | p == AppConstants :: PRIVILEGE [ :inactive ] } support_admin_chain = admin_chain . reject { | p | p == AppConstants :: PRIVILEGE [ :admin ] } super_user_chain = support_admin_chain . reject do | p | [ AppConstants :: PRIVILEGE [ :marketing_admin ] , AppConstants :: PRIVILEGE [ :support_admin ] , ] . include? ( p ) end member_chain = super_user_chain . reject { | p | p == AppConstants :: PRIVILEGE [ :super_user ] } case portal_privilege when AppConstants :: PRIVILEGE [ :admin ] admin_chain . include? ( privilege_type ) when AppConstants :: PRIVILEGE [ :support_admin ] support_admin_chain . include? ( privilege_type ) when AppConstants :: PRIVILEGE [ :user_manager ] super_user_chain . include? ( privilege_type ) when AppConstants :: PRIVILEGE [ :super_user ] super_user_chain . include? ( privilege_type ) when AppConstants :: PRIVILEGE [ :member ] member_chain . include? ( privilege_type ) end end
Determines if the contact has the specified privileges.
Determines if the contact has the specified privileges .
privilege_type