module PIM::Services::AccountService
Public Instance Methods
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 737 def broadcast_message message, severity = :success, opts = {} opts = PIM::Utils.unsymbolized_hash(opts) __account_service.broadcastMessage(message, severity.to_s, opts) end
# File services.rb, line 665 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
# File services.rb, line 672 def get_login_accounts return __convert(__account_service.getAllLoginAccounts(), to: LoginAccount, array: true, force: true) end
# File services.rb, line 685 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
Returns the list of Java-authored system roles registered in com.lansa.lax.auth.SystemRoles, converted to PIM::Authorization::Role instances. System roles cannot be defined in Ruby data models (the DSL rejects the +__system__+ name prefix), so this accessor is read-only by design.
The Java role objects returned by AccountService.getSystemRoles are explicitly not surfaced to Ruby callers: we route them through +__convert(…, force: true)+, which calls Role.toJson on the Java side and PIM::Authorization::Role.from_json on the Ruby side, so consumers only ever see Ruby classes. See the jruby-java-interop Cursor rule for why Ruby code must not reference com.lansa.lax.* classes directly.
Routed via the account service proxy rather than a direct com.lansa.lax.auth.SystemRoles.all call so that the binding works in every runtime (including the ones that don’t carry the mdm jar on their Ruby classpath).
# File services.rb, line 711 def get_system_roles return __convert(__account_service.getSystemRoles(), to: PIM::Authorization::Role, array: true, force: true) end
# File services.rb, line 677 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