Search in sources :

Example 1 with RemoteGroupProjectMapping

use of io.hops.hopsworks.persistence.entity.remote.group.RemoteGroupProjectMapping in project hopsworks by logicalclocks.

the class ConfigureLdap method submit.

public void submit() {
    Project project1;
    try {
        project1 = projectController.findProjectByName(this.project);
    } catch (ProjectException e) {
        String msg = e.getUsrMsg() != null ? e.getUsrMsg() : e.getErrorCode().getMessage();
        MessagesController.addErrorMessage("Project not found: ", msg);
        return;
    }
    for (String group : this.ldapGroups.getTarget()) {
        RemoteGroupProjectMapping lgpm = remoteGroupProjectMappingFacade.findByGroupAndProject(group, project1);
        if (lgpm != null) {
            MessagesController.addErrorMessage("Mapping: ", group + " to " + this.project + " already exists.");
            continue;
        }
        ldapConfigHelper.getLdapHelper().addNewGroupProjectMapping(new RemoteGroupProjectMapping(group, project1, this.project_role));
    }
    this.remoteGroupProjectMappings = remoteGroupProjectMappingFacade.findAll();
    MessagesController.addInfoMessage("Mappings added: ", this.ldapGroups.getTarget().toString() + " to " + this.project);
}
Also used : ProjectException(io.hops.hopsworks.exceptions.ProjectException) Project(io.hops.hopsworks.persistence.entity.project.Project) RemoteGroupProjectMapping(io.hops.hopsworks.persistence.entity.remote.group.RemoteGroupProjectMapping)

Example 2 with RemoteGroupProjectMapping

use of io.hops.hopsworks.persistence.entity.remote.group.RemoteGroupProjectMapping in project hopsworks by logicalclocks.

the class ConfigureLdap method onRowEdit.

public void onRowEdit(RowEditEvent event) {
    try {
        RemoteGroupProjectMapping mapping = (RemoteGroupProjectMapping) event.getObject();
        remoteGroupProjectMappingFacade.update(mapping);
        this.remoteGroupProjectMappings = remoteGroupProjectMappingFacade.findAll();
        MessagesController.addInfoMessage("Mapping edited.");
    } catch (Exception e) {
        MessagesController.addErrorMessage(e.getMessage());
    }
}
Also used : RemoteGroupProjectMapping(io.hops.hopsworks.persistence.entity.remote.group.RemoteGroupProjectMapping) ProjectException(io.hops.hopsworks.exceptions.ProjectException) ValidatorException(javax.faces.validator.ValidatorException) UserException(io.hops.hopsworks.exceptions.UserException)

Aggregations

ProjectException (io.hops.hopsworks.exceptions.ProjectException)2 RemoteGroupProjectMapping (io.hops.hopsworks.persistence.entity.remote.group.RemoteGroupProjectMapping)2 UserException (io.hops.hopsworks.exceptions.UserException)1 Project (io.hops.hopsworks.persistence.entity.project.Project)1 ValidatorException (javax.faces.validator.ValidatorException)1