Package org.apache.isis.applib.security

Examples of org.apache.isis.applib.security.UserMemento


        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
        final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

        final UserMemento user = new UserMemento(name, roleMementos);
        return user;
    }
View Full Code Here


    public static UserMemento createUserMemento(final AuthenticationSession session) {
        final List<RoleMemento> roles = Lists.newArrayList();
        for (final String roleName : session.getRoles()) {
            roles.add(new RoleMemento(roleName));
        }
        return new UserMemento(session.getUserName(), roles);
    }
View Full Code Here

        context.assertIsSatisfied();
    }

    @Test
    public void testGetUser() throws Exception {
        final UserMemento memento = new UserMemento("Harry");
        context.checking(new Expectations() {
            {
                one(container).getUser();
                will(returnValue(memento));

            }
        });

        final UserMemento user = object.getUser();
        assertEquals(memento, user);

        context.assertIsSatisfied();
    }
View Full Code Here

        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
        final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

        final UserMemento user = new UserMemento(name, roleMementos);
        return user;
    }
View Full Code Here

        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
        final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

        final UserMemento user = new UserMemento(name, roleMementos);
        return user;
    }
View Full Code Here

    public LocalDate getDueBy() {
        return dueBy;
    }

    public boolean hideDueBy() {
        final UserMemento user = container.getUser();
        return user.hasRole("realm1:noDueBy_role");
    }
View Full Code Here

    /**
     * Prevent user from modifying any other user's data.
     */
    public String disabled(Identifier.Type type){
        final UserMemento currentUser = container.getUser();
        final String currentUserName = currentUser.getName();
        if(Objects.equal(getOwnedBy(), currentUserName)) { return null; }
        return "This object is owned by '" + getOwnedBy() + "' and cannot be modified by you";
    }
View Full Code Here

    public LocalDate getDueBy() {
        return dueBy;
    }

    public boolean hideDueBy() {
        final UserMemento user = container.getUser();
        return user.hasRole("realm1:noDueBy_role");
    }
View Full Code Here

        final AuthenticationSession session = getAuthenticationSessionProvider().getAuthenticationSession();

        final String name = session.getUserName();
        final List<RoleMemento> roleMementos = asRoleMementos(session.getRoles());

        final UserMemento user = new UserMemento(name, roleMementos);
        return user;
    }
View Full Code Here

    public static UserMemento createUserMemento(final AuthenticationSession session) {
        final List<RoleMemento> roles = Lists.newArrayList();
        for (final String roleName : session.getRoles()) {
            roles.add(new RoleMemento(roleName));
        }
        return new UserMemento(session.getUserName(), roles);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.security.UserMemento

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.