Class SystemSessionData

  • All Implemented Interfaces:
    ProcessableForProxying, DelegatingUserPrincipal, RoleContainer, UserPrincipal, SessionData

    public class SystemSessionData
    extends AbstractSessionData
    A session data for running a piece of code as system.

    IMPORTANT: System doesn't have any role, that is why all those methods defined in RoleContainer return false.
    E.g: AbstractSessionData.isManagerOf(BasicUser) returns false due to System is not an admin nor a broker (i.e doesn't have any of the required roles). On the other hand, the method manages(BasicUser) return true because a System session can manage all users.
    This also implies that when implementing business logic in a method, we must treat System as a special case and not rely only in role-based methods to do the stuff.
    For example we should code in this way:
     if (sessionData.isSystem()) {
         // code for system...
     } else if (sessionData.isManagerOf(user)) {
         // code for admin/brokers...
     }