All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netgrif.application.engine.event.events.user.UserRoleChangeEvent Maven / Gradle / Ivy

Go to download

System provides workflow management functions including user, role and data management.

There is a newer version: 6.3.3
Show newest version
package com.netgrif.application.engine.event.events.user;

import com.netgrif.application.engine.auth.domain.IUser;
import com.netgrif.application.engine.auth.domain.LoggedUser;
import com.netgrif.application.engine.petrinet.domain.roles.ProcessRole;
import lombok.Getter;

import java.util.Collection;

public class UserRoleChangeEvent extends UserEvent {

    @Getter
    protected final Collection roles;

    public UserRoleChangeEvent(LoggedUser user, Collection roles) {
        super(user);
        this.roles = roles;
    }

    public UserRoleChangeEvent(IUser user, Collection roles) {
        super(user.transformToLoggedUser());
        this.roles = roles;
    }

    @Override
    public String getMessage() {
        StringBuilder sb = new StringBuilder("Roles ");
        roles.forEach(role -> {
            sb.append(role.getName());
            sb.append(",");
        });
        sb.append(" assigned to user ");
        sb.append(user.getUsername());
        return sb.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy