module PIM::Services::AccountService

Public Instance Methods

broadcast_message(message, severity = :success, opts = {}) click to toggle source

Shows a colored ‘popup’ message in the browser.

message:

  • a string message, can contain HTML code, e.g. links

severity:

  • :success (default, green color, top center of screen)

  • :info (blue color, bottom right of screen)

  • :warning (yellow color, bottom right of screen)

  • :error (red color, top center of screen)

opts:

  • reference_id (default 0): specifies the “location” of the message to show

    0: message is shown at top center
    1: message is shown at bottom right
  • time_to_live (default nil): 3000 to 5000 ms, depending on severity

  • include_self (default true): broadcast the message to the sending user itself

  • include_roles (default empty Array): only broadcast to users in specified roles

  • exclude_roles (default empty Array): don’t broadcast to users in specified roles

# File services.rb, line 697
def broadcast_message message, severity = :success, opts = {}
  opts = PIM::Utils.unsymbolized_hash(opts)
  __account_service.broadcastMessage(message, severity.to_s, opts)
end
get_login_account() click to toggle source
# File services.rb, line 652
def get_login_account
  login_account = __cached(:login_account) { __convert(__account_service.getCurrentLoginAccount(), to: LoginAccount) }
  raise "No current login account found" if login_account.nil?
  login_account
end
get_login_accounts() click to toggle source
# File services.rb, line 659
def get_login_accounts
  return __convert(__account_service.getAllLoginAccounts(), to: LoginAccount, array: true, force: true)
end
get_roles_for_user(user_id_or_email = nil) click to toggle source
# File services.rb, line 672
def get_roles_for_user user_id_or_email = nil
  user = get_user(user_id_or_email)
  return [] if user.nil? or user.get_roles.nil?
  return user.get_roles
end
get_user(username_or_email = nil) click to toggle source
# File services.rb, line 664
def get_user username_or_email = nil
  return get_login_account if username_or_email.nil?
  user = __cached("login_account_#{username_or_email}".to_sym) do
    __convert(__account_service.getLoginAccountByEmailOrUsername(username_or_email), to: LoginAccount)
  end
  user
end