Examples of RoleData


Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

        AuthenticatedUser authenticatedUser = ((AuthServiceImpl) authService).toAuthenticatedUser(auth);
        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(authenticatedUser,
                project.getId());

        RoleData role = getRole();

        DomainData domain = identityService.getDefaultDomain();

        UserData grantee = getGrantee(domain);

        log.info("Doing project grant: {} {}", grantee.getName(), role.getName());
        identityService.grantRoleToUserOnProject(authenticatedProject, grantee.getId(), role.getId());
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

        return user;
    }

    private RoleData getRole() throws CloudException {
        RoleData role = null;
        for (RoleData r : identityService.listRoles()) {
            if (roleName.equalsIgnoreCase(r.getName())) {
                role = r;
            }
        }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

        return user;
    }

    private RoleData getRole() throws CloudException {
        RoleData role = null;
        for (RoleData r : identityService.listRoles()) {
            if (roleName.equalsIgnoreCase(r.getName())) {
                role = r;
            }
        }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

    private void doDomainGrant() throws CloudException {
        // Domain grant
        DomainData domain = identityService.getDefaultDomain();

        RoleData role = getRole();

        UserData user = getGrantee(domain);

        log.info("Doing domain grant: {} {}", user.getName(), role.getName());
        identityService.grantDomainRoleToUser(domain.getId(), user.getId(), role.getId());
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

        response.roles = Lists.newArrayList();

        ProjectRoles projectRoles = Users.findProjectRoles(user, project.getId());
        if (projectRoles != null) {
            for (long roleId : projectRoles.getRoleList()) {
                RoleData role = identityService.findRole(roleId);
                if (role == null) {
                    log.warn("Role not found: {}", roleId);
                } else {
                    response.roles.add(toModel(role));
                }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

        if (authentication.getProjectRoleIds() != null) {
            user.roles = Lists.newArrayList();

            for (long roleId : authentication.getProjectRoleIds()) {
                RoleData role = identityService.findRole(roleId);
                if (role == null) {
                    throw new IllegalStateException();
                }

                Role model = toModel(project, role);
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

            return Collections.emptyList();
        }

        List<RoleData> ret = Lists.newArrayList();
        for (long roleId : found.getRoleList()) {
            RoleData role = authRepository.getRoles().find(roleId);
            if (role == null) {
                continue;
            }
            ret.add(role);
        }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

    @Override
    @Transactional
    public void grantRoleToUserOnProject(AuthenticatedProject authenticatedProject, long granteeUserId, long roleId)
            throws CloudException {
        RoleData role = authRepository.getRoles().find(roleId);
        if (role == null) {
            throw new IllegalArgumentException("Cannot find role");
        }

        long projectId = authenticatedProject.getProjectId();

        UserData granteeData = authRepository.getUsers().find(granteeUserId);
        if (granteeData == null) {
            throw new IllegalArgumentException();
        }

        UserData.Builder b = UserData.newBuilder(granteeData);

        {
            ProjectRoles.Builder pb = null;
            for (ProjectRoles.Builder i : b.getProjectRolesBuilderList()) {
                if (i.getProject() == projectId) {
                    pb = i;
                    break;
                }
            }

            if (pb == null) {
                pb = b.addProjectRolesBuilder();
                pb.setProject(projectId);
            }

            if (!pb.hasSecretData()) {
                try {
                    pb.setSecretData(Secrets.buildProjectRolesSecret(granteeData, authenticatedProject));
                } catch (KeyczarException e) {
                    throw new CloudException("Crypto error granting project role", e);
                }
            }

            if (!pb.getRoleList().contains(role.getId())) {
                pb.addRole(role.getId());
            }

            authRepository.getUsers().update(b);
        }
    }
View Full Code Here

Examples of io.fathom.cloud.protobuf.IdentityModel.RoleData

    }

    @Override
    @Transactional
    public void grantDomainRoleToUser(long domainId, long granteeUserId, long roleId) throws CloudException {
        RoleData role = authRepository.getRoles().find(roleId);
        if (role == null) {
            throw new IllegalArgumentException("Cannot find role");
        }

        UserData granteeData = authRepository.getUsers().find(granteeUserId);
        if (granteeData == null) {
            throw new IllegalArgumentException();
        }

        DomainData domain = authRepository.getDomains().find(domainId);
        if (domain == null) {
            throw new IllegalArgumentException();
        }

        UserData.Builder b = UserData.newBuilder(granteeData);

        {
            DomainRoles.Builder rb = null;
            for (DomainRoles.Builder i : b.getDomainRolesBuilderList()) {
                if (i.getDomain() == domainId) {
                    rb = i;
                    break;
                }
            }

            if (rb == null) {
                rb = b.addDomainRolesBuilder();
                rb.setDomain(domainId);
            }

            if (!rb.getRoleList().contains(role.getId())) {
                rb.addRole(role.getId());
            }

            authRepository.getUsers().update(b);
        }
    }
View Full Code Here

Examples of org.apache.aries.jmx.codec.RoleData

        }
        Role role = userAdmin.getRole(name);
        if (role == null) {
            return null;
        }
        return new RoleData(role).toCompositeData();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.