net.nemerosa.ontrack.model.security.ConnectedAccount Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.security;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import net.nemerosa.ontrack.model.structure.Entity;
import net.nemerosa.ontrack.model.support.Action;
import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class ConnectedAccount {
private final boolean authenticationRequired;
private final Account account;
private final List actions = new ArrayList<>();
public static ConnectedAccount none(boolean authenticationRequired) {
return new ConnectedAccount(authenticationRequired, null);
}
public static ConnectedAccount of(boolean authenticationRequired, Account account) {
Entity.isEntityDefined(account, "Account must be defined");
return new ConnectedAccount(authenticationRequired, account);
}
public boolean isLogged() {
return account != null;
}
public ConnectedAccount add(Action action) {
actions.add(action);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy