Sha256: 72c2171e12fbbf39a425a11881a4ed053334edcb57d0a175449f9b7635455ced

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

module SharingPluginHelper

  def current_user
    if UserSession.find.nil?
      @current_user ||= nil
    else
      @current_user ||= User.find(UserSession.find.record.id)
    end
  end

  # Get current user's role
  def get_current_user_role
    @current_user = current_user
    if (!@current_user.nil?)
      siteId = session[:accessible_appid]
      roleId = session[:accessible_roleid]

      if (!siteId.nil? && !roleId.nil?)
        userRole = Role.find(roleId)
        @curUserRole = userRole.name
      else
        @curUserRole = 'loggedin'
      end

    else
      @curUserRole = 'anonymous'
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rxcms-sharing_plugin-0.4.0 app/helpers/sharing_plugin_helper.rb
rxcms-sharing_plugin-0.3.0 app/helpers/sharing_plugin_helper.rb
rxcms-sharing_plugin-0.2.0 app/helpers/sharing_plugin_helper.rb