Package de.iritgo.aktera.authentication

Examples of de.iritgo.aktera.authentication.UserEnvironment


   */
  public static Object getContextObject(ModelRequest req, String key)
  {
    try
    {
      UserEnvironment ue = (UserEnvironment) req.getContext().get(UserEnvironment.CONTEXT_KEY);

      return ue.getAttribute(key);
    }
    catch (ContextException x)
    {
    }
    catch (ModelException x)
View Full Code Here


   */
  public static void setContextObject(ModelRequest req, String key, Object val)
  {
    try
    {
      UserEnvironment ue = (UserEnvironment) req.getContext().get(UserEnvironment.CONTEXT_KEY);

      ue.setAttribute(key, val);
    }
    catch (ContextException x)
    {
    }
    catch (ModelException x)
View Full Code Here

   */
  public static void removeContextObject(ModelRequest req, String key)
  {
    try
    {
      UserEnvironment ue = (UserEnvironment) req.getContext().get(UserEnvironment.CONTEXT_KEY);

      ue.removeAttribute(key);
    }
    catch (ContextException x)
    {
    }
    catch (ModelException x)
View Full Code Here

  {
    try
    {
      Context context = req.getContext();

      UserEnvironment userEnv = (UserEnvironment) context.get(UserEnvironment.CONTEXT_KEY);

      if (userEnv != null)
      {
        for (Iterator i = userEnv.getGroups().iterator(); i.hasNext();)
        {
          String aGroup = (String) i.next();

          if (aGroup.equals(groupName))
          {
View Full Code Here

   */
  public boolean allowed(Object service, Context c) throws AuthorizationException
  {
    try
    {
      UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

      if (rootBypass)
      {
        // Group "root" is an exception: granted auth in all cases
        if (ue.getGroups().contains("root"))
        {
          return true;
        }
      }

View Full Code Here

              + o.getService().toString());
    }

    try
    {
      UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

      returnValue = allowed(o, ue);
    }
    catch (AuthorizationException ae)
    {
View Full Code Here

    try
    {
      Context c = getContext();

      UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

      if (ue != null)
      {
        returnValue = ue.getUid();
      }
    }
    catch (ContextException ce)
    {
      log.error("No user information in context");
View Full Code Here

    Context ctx = req.getContext();

    if (ctx != null)
    {
      UserEnvironment userEnv = null;

      try
      {
        userEnv = (UserEnvironment) ctx.get(UserEnvironment.CONTEXT_KEY);
      }
      catch (ContextException x)
      {
      }

      try
      {
        if (userEnv != null && userEnv.getUid() != UserEnvironment.ANONYMOUS_UID)
        {
          if (userEnv.getAttribute("sessionInfoLoaded") == null
                  || "N".equals(userEnv.getAttribute("sessionInfoLoaded")))
          {
            try
            {
              PersistentFactory persistentManager = (PersistentFactory) req.getService(
                      PersistentFactory.ROLE, req.getDomain());

              Persistent preferences = persistentManager.create("aktera.Preferences");

              preferences.setField("userId", new Integer(userEnv.getUid()));
              preferences.find();
              userEnv.setAttribute("sessionPreferences", preferences.getBean());

              Persistent party = persistentManager.create("aktera.Party");

              party.setField("userId", new Integer(userEnv.getUid()));

              if (party.find())
              {
                Persistent address = persistentManager.create("aktera.Address");

                address.setField("partyId", party.getField("partyId"));

                if (address.find())
                {
                  String firstName = address.getFieldString("firstName");
                  String lastName = address.getFieldString("lastName");
                  String displayName = (firstName != null ? firstName + " " : "") + lastName;

                  userEnv.setAttribute("sessionDisplayName", displayName);
                  userEnv.setAttribute("sessionFirstName", firstName != null ? firstName : "");
                  userEnv.setAttribute("sessionLastName", lastName != null ? lastName : "");

                  Locale locale = (Locale) languages.get(preferences.getFieldString("language"));

                  userEnv.setAttribute("sessionLanguage", locale != null ? locale : Locale.GERMAN);
                  userEnv.setAttribute(I18N.USER_CONTEXT_LOCALE_KEY, locale != null ? locale
                          : Locale.GERMAN);
                  userEnv.setAttribute("sessionInfoLoaded", "Y");
                }
              }
            }
            catch (PersistenceException x)
            {
              throw new ModelException(x);
            }
          }

          res.addOutput("sessionDisplayName", (String) userEnv.getAttribute("sessionDisplayName"));
          res.addOutput("sessionFirstName", (String) userEnv.getAttribute("sessionFirstName"));
          res.addOutput("sessionLastName", (String) userEnv.getAttribute("sessionLastName"));
          res.addOutput("sessionLoginName", (String) userEnv.getLoginName());

          Output lang = res.createOutput("sessionLanguage");

          lang.setContent(userEnv.getAttribute("sessionLanguage"));
          res.add(lang);
        }
        else
        {
          Output lang = res.createOutput("sessionLanguage");
View Full Code Here

      if (c == null)
      {
        throw new IllegalArgumentException("No context");
      }

      UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

      if (ue != null)
      {
        returnValue = ue.getDomain();
      }
    }
    catch (ContextException ignored)
    {
    }
View Full Code Here

      DefaultPersistentFactory dpf = getFactory();
      Context c = dpf.getKeelContext();

      if (c != null)
      {
        UserEnvironment ue = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);

        if (ue == null)
        {
          failedUserName = "(No user logged in)";
        }
        else
        {
          failedUserName = ue.getLoginName();
          failedUserId = "" + ue.getUid();
        }
      }
    }
    catch (Exception pe)
    {
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.authentication.UserEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.