Module: SharingPluginHelper

Included in:
SharingEngineController, SharingInstallerController, SharingServicesController
Defined in:
app/helpers/sharing_plugin_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject



3
4
5
6
7
8
9
# File 'app/helpers/sharing_plugin_helper.rb', line 3

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

#get_current_user_roleObject

Get current user’s role



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/sharing_plugin_helper.rb', line 12

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