use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class RoleConversionUtil method toUpateRoleEntity.
/**
* To upate role entity.
*
* @param role the role
* @param roleEntity the role entity
* @return the role entity
*/
public static RoleEntity toUpateRoleEntity(final Role role, final RoleEntity roleEntity) {
if (!ValidatorUtil.isNull(role.getStatus())) {
StatusEntity newStatusEntity = Status.getStatusByName(role.getStatus()).getStatusEntity();
roleEntity.setStatusEntity(newStatusEntity);
}
if (!ValidatorUtil.isNull(role.getName())) {
roleEntity.setName(role.getName());
}
if (!ValidatorUtil.isNull(role.getDescription())) {
roleEntity.setDescription(role.getDescription());
}
roleEntity.setCreatedDate(new Date());
roleEntity.setUpdatedDate(new Date());
return roleEntity;
}
use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class PermissionConversionUtil method toUpatePermissionEntity.
/**
* To upate permission entity.
*
* @param permission the permission
* @param permissionEntity the permission entity
* @return the permission entity
*/
public static PermissionEntity toUpatePermissionEntity(final Permission permission, final PermissionEntity permissionEntity) {
if (!ValidatorUtil.isNull(permission.getStatus())) {
StatusEntity newStatusEntity = Status.getStatusByName(permission.getStatus()).getStatusEntity();
permissionEntity.setStatusEntity(newStatusEntity);
}
if (!ValidatorUtil.isNull(permission.getName())) {
permissionEntity.setName(permission.getName());
}
if (!ValidatorUtil.isNull(permission.getDescription())) {
permissionEntity.setDescription(permission.getDescription());
}
if (!ValidatorUtil.isNull(permission.getIsAdminPermission())) {
permissionEntity.setIsAdminPermission(permission.getIsAdminPermission());
}
permissionEntity.setCreatedDate(new Date());
permissionEntity.setUpdatedDate(new Date());
return permissionEntity;
}
use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class UserService method createSamlUser.
/**
* Creates the saml user.
* @param username the username
* @param roles the user roles
*/
public void createSamlUser(String username, Set<RoleEntity> roles) {
UserEntity userEntity = new UserEntity();
userEntity.setUsername(username);
userEntity.setEmail(username);
userEntity.setName(username);
userEntity.setRoles(roles);
userEntity.setActiveFlag(true);
userEntity.setLoginTime(new Timestamp(System.currentTimeMillis()));
userEntity.setLogoutTime(new Timestamp(System.currentTimeMillis()));
userEntity.setIsAuthorized(true);
userEntity.setIs2FaEnabled(false);
userEntity.setIs2FaConfigured(false);
StatusEntity statusEntity = Status.ACTIVE.getStatusEntity();
userEntity.setStatusEntity(statusEntity);
String password = ValidatorUtil.randomAlphaNumeric(16);
userEntity.setPassword(StringUtil.encodeString(password));
userRepository.save(userEntity);
}
use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class RoleConversionUtil method toRoleEntity.
/**
* To role entity.
*
* @param role the role
* @param permissionEntitySet the permission entity set
* @return the role entity
*/
public static RoleEntity toRoleEntity(final Role role, final Set<PermissionEntity> permissionEntitySet) {
RoleEntity roleEntity = new RoleEntity();
roleEntity.setName(role.getName());
roleEntity.setPermissions(permissionEntitySet);
roleEntity.setDescription(role.getDescription());
StatusEntity statusEntity = Status.ACTIVE.getStatusEntity();
roleEntity.setStatusEntity(statusEntity);
return roleEntity;
}
use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class PermissionConversionUtil method toPermissionEntity.
/**
* To permission entity.
*
* @param permission the permission
* @return the permission entity
*/
public static PermissionEntity toPermissionEntity(final Permission permission) {
PermissionEntity permissionEntity = new PermissionEntity();
permissionEntity.setName(permission.getName());
permissionEntity.setDescription(permission.getDescription());
permissionEntity.setIsEditable(permission.getIsEditable());
permissionEntity.setIsAdminPermission(permission.getIsAdminPermission());
StatusEntity statusEntity = Status.ACTIVE.getStatusEntity();
permissionEntity.setStatusEntity(statusEntity);
return permissionEntity;
}
Aggregations