private void processSystemCommand()

in src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java [850:909]


    private void processSystemCommand( Set<String> commands, Options options )
    {
        String command;
        try
        {
            if ( commands.contains( CREATE_SESSION ) )
            {
                command = CREATE_SESSION;
                LOG.info( READ_USER );
                User inUser = options.getUser();
                Session session = accessMgr.createSession( inUser, false );
                printSession( session );
            }
            else if ( commands.contains( AUTHENTICATE ) )
            {
                command = AUTHENTICATE;
                LOG.info( command );
                User inUser = options.getUser();
                Session session = accessMgr.authenticate( inUser.getUserId(), inUser.getPassword() );
                printSession( session );
            }
            else if ( commands.contains( ASSIGNED_ROLES ) )
            {
                command = ASSIGNED_ROLES;
                LOG.info( command );
                User inUser = options.getUser();
                Session session = accessMgr.createSession( inUser, true );
                List<UserRole> uRoles = accessMgr.sessionRoles( session );
                if ( uRoles != null )
                {
                    for ( UserRole ur : uRoles )
                    {
                        printTemporal( "R", ur, "RBACROLE" );
                        printSeparator();
                    }
                }
            }
            else if ( commands.contains( CHECK_ACCESS ) )
            {
                command = CHECK_ACCESS;
                LOG.info( command );
                Permission inPerm = options.getPermission();
                User inUser = options.getUser();
                Session session = accessMgr.createSession( inUser, true );
                boolean result = accessMgr.checkAccess( session, inPerm );
                printRow( "CA", "PERM", "" + result );
            }
            else
            {
                LOG.warn( "unknown system operation detected" );
                return;
            }
            LOG.info( "command:{} was successful", command );
        }
        catch ( SecurityException se )
        {
            String error = "processSystemCommand caught SecurityException=" + se + ", return code=" + se.getErrorId();
            LOG.error( error );
        }
    }