Environment
One feature that you may want to use in your portal frame is the flash notice. The flash notice is available for you to use after certain events happen. For example after a user logs in, a message that states, 'login successful' is available for you to display in your portal. You can render this flash message anywhere in your portal layout with the following additional code:
<%= render :partial => 'flash', :object => flash %>
The flash notice is one of many aspects of the portal environment. Variables are another aspect of the portal environment that we wish to consider. We briefly touched on this subject above when looking at the @logged_in variable. There are many variables available for you to use, and are used in the many pre-defined views. You can see the available variables by turning on debugging. First you will need to add the following code into your main portal layout:
<% if params.has_key? :debug %>
<br />
<%= debug_inline.html_safe %>
<% end %>
Once you have that code in your main layout, you can enable the debugging by adding ?debug=true
to the end of the URL you are using to view the portal. You can use these variables to dynamically generate content that suits your needs.
The debug variables may also be brought up by clicking on the_Show Debug Popup_ button that is displayed at the top of every page when the web server is in development mode.
The following variables are relevant for most portal conditionals:
@current_login_identifierThe login of the end-user. This is usable for both local and remote authentication.@current_accountThe current local user object for a logged in end-user (if local authentication is being used).@client_ipThe IP address of the device that is hitting the portal.@client_macThe MAC address of the device that is hitting the portal.@effective_portal The end-user's configured splash portal or landing portal depending upon login state. Landing_portal is usually defined only if logged_in?
is true. An exception is when an end-user has an existing LoginSession stored but has to re-authenticate because her session is empty (cleared cookies/new browser).@groupThe effective group of the end-user. If the end-user is a member of multiple groups, only the final disambiguated group (based on group priority) is reported.@policyThe policy that is linked to the effective group of the end-user. @logged_intrue
if the end-user has supplied valid credentials to the portal.@portal_nameThe controller name of the portal being displayed.@portal_controllerThe controller name of the portal being displayed.@usage_plansThe list of usage plans that this end-user may select from.