use of org.isisaddons.module.security.dom.user.ApplicationUser in project estatio by estatio.
the class ApplicationUserBuilder method execute.
@Override
protected void execute(ExecutionContext executionContext) {
checkParam("person", executionContext, Person.class);
checkParam("securityUsername", executionContext, String.class);
defaultParam("securityUserAccountCloneFrom", executionContext, "estatio-admin");
if (securityUsername != null) {
ApplicationUser userToCloneFrom = applicationUserRepository.findByUsername(securityUserAccountCloneFrom);
if (userToCloneFrom == null) {
throw new IllegalArgumentException("Could not find any user with username: " + securityUserAccountCloneFrom);
}
object = applicationUserRepository.newLocalUserBasedOn(securityUsername, new Password("pass"), new Password("pass"), userToCloneFrom, true, null);
object.setAtPath(person.getAtPath());
person.setUsername(securityUsername);
executionContext.addResult(this, securityUsername, userToCloneFrom);
}
}
use of org.isisaddons.module.security.dom.user.ApplicationUser in project estatio by estatio.
the class AbstractUserRoleFixtureScript method addUserToRole.
protected ApplicationUser addUserToRole(final String userName, final String roleName, final ExecutionContext executionContext) {
final ApplicationUser user = applicationUserRepository.findOrCreateUserByUsername(userName);
final ApplicationRole applicationRole = applicationRoleRepository.findByName(roleName);
if (applicationRole == null) {
throw new IllegalArgumentException(String.format("Role [%s] not found", roleName));
}
user.addRole(applicationRole);
executionContext.addResult(this, roleName, applicationRole);
return user;
}
use of org.isisaddons.module.security.dom.user.ApplicationUser in project estatio by estatio.
the class DocumentMenu method upload.
@Action(domainEvent = IncomingDocumentRepository.UploadDomainEvent.class, commandDtoProcessor = DeriveBlobFromReturnedDocumentArg0.class)
@MemberOrder(sequence = "3")
public Document upload(final Blob blob) {
final String name = blob.getName();
final DocumentType type = DocumentTypeData.INCOMING.findUsing(documentTypeRepository);
final ApplicationUser me = meService.me();
String atPath = me != null ? me.getAtPath() : null;
if (atPath == null) {
atPath = "/";
}
return incomingDocumentRepository.upsertAndArchive(type, atPath, name, blob);
}
use of org.isisaddons.module.security.dom.user.ApplicationUser in project estatio by estatio.
the class EstatioUserProfileService method userProfileName.
@Programmatic
@Override
public String userProfileName() {
final ApplicationUser currentUser = meService.me();
final String atPath = currentUser.getAtPath();
if (atPath != null) {
return String.format("%s @ %s", currentUser.getName(), atPath);
} else {
return String.format("%s", currentUser.getName());
}
}
Aggregations