Package com.saasovation.identityaccess.domain.model.identity

Examples of com.saasovation.identityaccess.domain.model.identity.Group


    public void testUserIsInRole() throws Exception {
        Tenant tenant = this.tenantAggregate();
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);
        Role managerRole = tenant.provisionRole("Manager", "A manager role.", true);
        Group group = new Group(user.tenantId(), "Managers", "A group of managers.");
        DomainRegistry.groupRepository().add(group);
        managerRole.assignGroup(group, DomainRegistry.groupMemberService());
        DomainRegistry.roleRepository().add(managerRole);
        group.addUser(user);

        assertTrue(group.isMember(user, DomainRegistry.groupMemberService()));
        assertTrue(managerRole.isInRole(user, DomainRegistry.groupMemberService()));
    }
View Full Code Here


    public void testUserIsNotInRole() throws Exception {
        Tenant tenant = this.tenantAggregate();
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);
        Role managerRole = tenant.provisionRole("Manager", "A manager role.", true);
        Group group = tenant.provisionGroup("Managers", "A group of managers.");
        DomainRegistry.groupRepository().add(group);
        managerRole.assignGroup(group, DomainRegistry.groupMemberService());
        DomainRegistry.roleRepository().add(managerRole);
        Role accountantRole = new Role(user.tenantId(), "Accountant", "An accountant role.");
        DomainRegistry.roleRepository().add(accountantRole);
View Full Code Here

        Tenant tenant = this.tenantAggregate();
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);
        Role managerRole = tenant.provisionRole("Manager", "A manager role.", true);
        Group group = new Group(user.tenantId(), "Managers", "A group of managers.");
        DomainRegistry.groupRepository().add(group);
        managerRole.assignGroup(group, DomainRegistry.groupMemberService());
        managerRole.assignUser(user);
        DomainRegistry.roleRepository().add(managerRole);
        group.addUser(user); // legal add

        assertEquals(2, roleSomethingAssignedCount);
        assertEquals(1, groupSomethingAddedCount);
    }
View Full Code Here

        Tenant tenant = this.tenantAggregate();
        User user = this.userAggregate();
        DomainRegistry.userRepository().add(user);
        Role managerRole = tenant.provisionRole("Manager", "A manager role.", true);
        Group group = new Group(user.tenantId(), "Managers", "A group of managers.");
        DomainRegistry.groupRepository().add(group);
        managerRole.assignUser(user);
        managerRole.assignGroup(group, DomainRegistry.groupMemberService());
        DomainRegistry.roleRepository().add(managerRole);
View Full Code Here

    public Response getGroup(
            @PathParam("tenantId") String aTenantId,
            @PathParam("groupName") String aGroupName,
            @Context Request aRequest) {

        Group group =
                this.identityApplicationService()
                    .group(aTenantId, aGroupName);

        if (group == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
View Full Code Here

        tenant.activate();
    }

    @Transactional
    public void addGroupToGroup(AddGroupToGroupCommand aCommand) {
        Group parentGroup =
                this.existingGroup(
                        aCommand.getTenantId(),
                        aCommand.getParentGroupName());

        Group childGroup =
                this.existingGroup(
                        aCommand.getTenantId(),
                        aCommand.getChildGroupName());

        parentGroup.addGroup(childGroup, this.groupMemberService());
View Full Code Here

        parentGroup.addGroup(childGroup, this.groupMemberService());
    }

    @Transactional
    public void addUserToGroup(AddUserToGroupCommand aCommand) {
        Group group =
                this.existingGroup(
                        aCommand.getTenantId(),
                        aCommand.getGroupName());

        User user =
                this.existingUser(
                        aCommand.getTenantId(),
                        aCommand.getUsername());

        group.addUser(user);
    }
View Full Code Here

                        aCommand.getEndDate()));
    }

    @Transactional(readOnly=true)
    public Group group(String aTenantId, String aGroupName) {
        Group group =
                this.groupRepository()
                    .groupNamed(new TenantId(aTenantId), aGroupName);

        return group;
    }
View Full Code Here

        return group;
    }

    @Transactional(readOnly=true)
    public boolean isGroupMember(String aTenantId, String aGroupName, String aUsername) {
        Group group =
                this.existingGroup(
                        aTenantId,
                        aGroupName);

        User user =
                this.existingUser(
                        aTenantId,
                        aUsername);

        return group.isMember(user, this.groupMemberService());
    }
View Full Code Here

    @Transactional
    public Group provisionGroup(ProvisionGroupCommand aCommand) {
        Tenant tenant = this.existingTenant(aCommand.getTenantId());

        Group group =
                tenant.provisionGroup(
                        aCommand.getGroupName(),
                        aCommand.getDescription());

        this.groupRepository().add(group);
View Full Code Here

TOP

Related Classes of com.saasovation.identityaccess.domain.model.identity.Group

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.