Merge branch 'jhipster-generated' with initially imported accessrighs.jdl
This commit is contained in:
commit
3908ff3d74
@ -49,7 +49,7 @@
|
||||
"otherEntityField": "admissionDocumentDate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430150327",
|
||||
"changelogDate": "20190430152139",
|
||||
"entityTableName": "asset",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
|
@ -142,7 +142,7 @@
|
||||
"relationshipName": "sepamandate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430150324",
|
||||
"changelogDate": "20190430152136",
|
||||
"entityTableName": "customer",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
|
@ -54,7 +54,7 @@
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430150325",
|
||||
"changelogDate": "20190430152137",
|
||||
"entityTableName": "membership",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
|
@ -72,7 +72,7 @@
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430150328",
|
||||
"changelogDate": "20190430152140",
|
||||
"entityTableName": "sepa_mandate",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
|
@ -49,7 +49,7 @@
|
||||
"otherEntityField": "admissionDocumentDate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430150326",
|
||||
"changelogDate": "20190430152138",
|
||||
"entityTableName": "share",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
|
46
.jhipster/UserRoleAssignment.json
Normal file
46
.jhipster/UserRoleAssignment.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "UserRoleAssignment",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "entityTypeId",
|
||||
"fieldType": "String"
|
||||
},
|
||||
{
|
||||
"fieldName": "entityObjectId",
|
||||
"fieldType": "Long"
|
||||
},
|
||||
{
|
||||
"fieldName": "userId",
|
||||
"fieldType": "Long",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "assignedRole",
|
||||
"fieldType": "UserRole",
|
||||
"fieldValues": "HOSTMASTER,ADMIN,SUPPORTER,CONTRACTUAL_CONTACT,FINANCIAL_CONTACT,TECHNICAL_CONTACT,CUSTOMER_USER",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "user",
|
||||
"otherEntityRelationshipName": "required",
|
||||
"relationshipName": "user",
|
||||
"otherEntityField": "login"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190430152204",
|
||||
"entityTableName": "user_role_assignment",
|
||||
"dto": "no",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.domain;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.UserRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* A UserRoleAssignment.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "user_role_assignment")
|
||||
public class UserRoleAssignment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "entity_type_id")
|
||||
private String entityTypeId;
|
||||
|
||||
@Column(name = "entity_object_id")
|
||||
private Long entityObjectId;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private Long userId;
|
||||
|
||||
@NotNull
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "assigned_role", nullable = false)
|
||||
private UserRole assignedRole;
|
||||
|
||||
@ManyToOne
|
||||
@JsonIgnoreProperties("requireds")
|
||||
private User user;
|
||||
|
||||
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getEntityTypeId() {
|
||||
return entityTypeId;
|
||||
}
|
||||
|
||||
public UserRoleAssignment entityTypeId(String entityTypeId) {
|
||||
this.entityTypeId = entityTypeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setEntityTypeId(String entityTypeId) {
|
||||
this.entityTypeId = entityTypeId;
|
||||
}
|
||||
|
||||
public Long getEntityObjectId() {
|
||||
return entityObjectId;
|
||||
}
|
||||
|
||||
public UserRoleAssignment entityObjectId(Long entityObjectId) {
|
||||
this.entityObjectId = entityObjectId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setEntityObjectId(Long entityObjectId) {
|
||||
this.entityObjectId = entityObjectId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public UserRoleAssignment userId(Long userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public UserRole getAssignedRole() {
|
||||
return assignedRole;
|
||||
}
|
||||
|
||||
public UserRoleAssignment assignedRole(UserRole assignedRole) {
|
||||
this.assignedRole = assignedRole;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setAssignedRole(UserRole assignedRole) {
|
||||
this.assignedRole = assignedRole;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public UserRoleAssignment user(User user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
UserRoleAssignment userRoleAssignment = (UserRoleAssignment) o;
|
||||
if (userRoleAssignment.getId() == null || getId() == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(getId(), userRoleAssignment.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserRoleAssignment{" +
|
||||
"id=" + getId() +
|
||||
", entityTypeId='" + getEntityTypeId() + "'" +
|
||||
", entityObjectId=" + getEntityObjectId() +
|
||||
", userId=" + getUserId() +
|
||||
", assignedRole='" + getAssignedRole() + "'" +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.domain.enumeration;
|
||||
|
||||
/**
|
||||
* The UserRole enumeration.
|
||||
*/
|
||||
public enum UserRole {
|
||||
HOSTMASTER,
|
||||
ADMIN,
|
||||
SUPPORTER,
|
||||
CONTRACTUAL_CONTACT,
|
||||
FINANCIAL_CONTACT,
|
||||
TECHNICAL_CONTACT,
|
||||
CUSTOMER_USER
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.repository;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.UserRoleAssignment;
|
||||
|
||||
import org.springframework.data.jpa.repository.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Spring Data repository for the UserRoleAssignment entity.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Repository
|
||||
public interface UserRoleAssignmentRepository
|
||||
extends JpaRepository<UserRoleAssignment, Long>, JpaSpecificationExecutor<UserRoleAssignment> {
|
||||
|
||||
@Query("select user_role_assignment from UserRoleAssignment user_role_assignment where user_role_assignment.user.login = ?#{principal.username}")
|
||||
List<UserRoleAssignment> findByUserIsCurrentUser();
|
||||
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.service;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.*;
|
||||
import org.hostsharing.hsadminng.domain.UserRoleAssignment;
|
||||
import org.hostsharing.hsadminng.repository.UserRoleAssignmentRepository;
|
||||
import org.hostsharing.hsadminng.service.dto.UserRoleAssignmentCriteria;
|
||||
|
||||
import io.github.jhipster.service.QueryService;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.criteria.JoinType;
|
||||
|
||||
/**
|
||||
* Service for executing complex queries for UserRoleAssignment entities in the database.
|
||||
* The main input is a {@link UserRoleAssignmentCriteria} which gets converted to {@link Specification},
|
||||
* in a way that all the filters must apply.
|
||||
* It returns a {@link List} of {@link UserRoleAssignment} or a {@link Page} of {@link UserRoleAssignment} which fulfills the
|
||||
* criteria.
|
||||
*/
|
||||
@Service
|
||||
@Transactional(readOnly = true)
|
||||
public class UserRoleAssignmentQueryService extends QueryService<UserRoleAssignment> {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(UserRoleAssignmentQueryService.class);
|
||||
|
||||
private final UserRoleAssignmentRepository userRoleAssignmentRepository;
|
||||
|
||||
public UserRoleAssignmentQueryService(UserRoleAssignmentRepository userRoleAssignmentRepository) {
|
||||
this.userRoleAssignmentRepository = userRoleAssignmentRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link List} of {@link UserRoleAssignment} which matches the criteria from the database
|
||||
*
|
||||
* @param criteria The object which holds all the filters, which the entities should match.
|
||||
* @return the matching entities.
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<UserRoleAssignment> findByCriteria(UserRoleAssignmentCriteria criteria) {
|
||||
log.debug("find by criteria : {}", criteria);
|
||||
final Specification<UserRoleAssignment> specification = createSpecification(criteria);
|
||||
return userRoleAssignmentRepository.findAll(specification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link Page} of {@link UserRoleAssignment} which matches the criteria from the database
|
||||
*
|
||||
* @param criteria The object which holds all the filters, which the entities should match.
|
||||
* @param page The page, which should be returned.
|
||||
* @return the matching entities.
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Page<UserRoleAssignment> findByCriteria(UserRoleAssignmentCriteria criteria, Pageable page) {
|
||||
log.debug("find by criteria : {}, page: {}", criteria, page);
|
||||
final Specification<UserRoleAssignment> specification = createSpecification(criteria);
|
||||
return userRoleAssignmentRepository.findAll(specification, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of matching entities in the database
|
||||
*
|
||||
* @param criteria The object which holds all the filters, which the entities should match.
|
||||
* @return the number of matching entities.
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public long countByCriteria(UserRoleAssignmentCriteria criteria) {
|
||||
log.debug("count by criteria : {}", criteria);
|
||||
final Specification<UserRoleAssignment> specification = createSpecification(criteria);
|
||||
return userRoleAssignmentRepository.count(specification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to convert UserRoleAssignmentCriteria to a {@link Specification}
|
||||
*/
|
||||
private Specification<UserRoleAssignment> createSpecification(UserRoleAssignmentCriteria criteria) {
|
||||
Specification<UserRoleAssignment> specification = Specification.where(null);
|
||||
if (criteria != null) {
|
||||
if (criteria.getId() != null) {
|
||||
specification = specification.and(buildSpecification(criteria.getId(), UserRoleAssignment_.id));
|
||||
}
|
||||
if (criteria.getEntityTypeId() != null) {
|
||||
specification = specification
|
||||
.and(buildStringSpecification(criteria.getEntityTypeId(), UserRoleAssignment_.entityTypeId));
|
||||
}
|
||||
if (criteria.getEntityObjectId() != null) {
|
||||
specification = specification
|
||||
.and(buildRangeSpecification(criteria.getEntityObjectId(), UserRoleAssignment_.entityObjectId));
|
||||
}
|
||||
if (criteria.getUserId() != null) {
|
||||
specification = specification.and(buildRangeSpecification(criteria.getUserId(), UserRoleAssignment_.userId));
|
||||
}
|
||||
if (criteria.getAssignedRole() != null) {
|
||||
specification = specification
|
||||
.and(buildSpecification(criteria.getAssignedRole(), UserRoleAssignment_.assignedRole));
|
||||
}
|
||||
if (criteria.getUserId() != null) {
|
||||
specification = specification.and(
|
||||
buildSpecification(
|
||||
criteria.getUserId(),
|
||||
root -> root.join(UserRoleAssignment_.user, JoinType.LEFT).get(User_.id)));
|
||||
}
|
||||
}
|
||||
return specification;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.service;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.UserRoleAssignment;
|
||||
import org.hostsharing.hsadminng.repository.UserRoleAssignmentRepository;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Service Implementation for managing UserRoleAssignment.
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class UserRoleAssignmentService {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(UserRoleAssignmentService.class);
|
||||
|
||||
private final UserRoleAssignmentRepository userRoleAssignmentRepository;
|
||||
|
||||
public UserRoleAssignmentService(UserRoleAssignmentRepository userRoleAssignmentRepository) {
|
||||
this.userRoleAssignmentRepository = userRoleAssignmentRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a userRoleAssignment.
|
||||
*
|
||||
* @param userRoleAssignment the entity to save
|
||||
* @return the persisted entity
|
||||
*/
|
||||
public UserRoleAssignment save(UserRoleAssignment userRoleAssignment) {
|
||||
log.debug("Request to save UserRoleAssignment : {}", userRoleAssignment);
|
||||
return userRoleAssignmentRepository.save(userRoleAssignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the userRoleAssignments.
|
||||
*
|
||||
* @param pageable the pagination information
|
||||
* @return the list of entities
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Page<UserRoleAssignment> findAll(Pageable pageable) {
|
||||
log.debug("Request to get all UserRoleAssignments");
|
||||
return userRoleAssignmentRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one userRoleAssignment by id.
|
||||
*
|
||||
* @param id the id of the entity
|
||||
* @return the entity
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Optional<UserRoleAssignment> findOne(Long id) {
|
||||
log.debug("Request to get UserRoleAssignment : {}", id);
|
||||
return userRoleAssignmentRepository.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the userRoleAssignment by id.
|
||||
*
|
||||
* @param id the id of the entity
|
||||
*/
|
||||
public void delete(Long id) {
|
||||
log.debug("Request to delete UserRoleAssignment : {}", id);
|
||||
userRoleAssignmentRepository.deleteById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.service.dto;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.UserRole;
|
||||
|
||||
import io.github.jhipster.service.filter.Filter;
|
||||
import io.github.jhipster.service.filter.LongFilter;
|
||||
import io.github.jhipster.service.filter.StringFilter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Criteria class for the UserRoleAssignment entity. This class is used in UserRoleAssignmentResource to
|
||||
* receive all the possible filtering options from the Http GET request parameters.
|
||||
* For example the following could be a valid requests:
|
||||
* <code> /user-role-assignments?id.greaterThan=5&attr1.contains=something&attr2.specified=false</code>
|
||||
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
|
||||
* fix type specific filters.
|
||||
*/
|
||||
public class UserRoleAssignmentCriteria implements Serializable {
|
||||
|
||||
/**
|
||||
* Class for filtering UserRole
|
||||
*/
|
||||
public static class UserRoleFilter extends Filter<UserRole> {
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private LongFilter id;
|
||||
|
||||
private StringFilter entityTypeId;
|
||||
|
||||
private LongFilter entityObjectId;
|
||||
|
||||
private LongFilter userId;
|
||||
|
||||
private UserRoleFilter assignedRole;
|
||||
|
||||
private LongFilter userId;
|
||||
|
||||
public LongFilter getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(LongFilter id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public StringFilter getEntityTypeId() {
|
||||
return entityTypeId;
|
||||
}
|
||||
|
||||
public void setEntityTypeId(StringFilter entityTypeId) {
|
||||
this.entityTypeId = entityTypeId;
|
||||
}
|
||||
|
||||
public LongFilter getEntityObjectId() {
|
||||
return entityObjectId;
|
||||
}
|
||||
|
||||
public void setEntityObjectId(LongFilter entityObjectId) {
|
||||
this.entityObjectId = entityObjectId;
|
||||
}
|
||||
|
||||
public LongFilter getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(LongFilter userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public UserRoleFilter getAssignedRole() {
|
||||
return assignedRole;
|
||||
}
|
||||
|
||||
public void setAssignedRole(UserRoleFilter assignedRole) {
|
||||
this.assignedRole = assignedRole;
|
||||
}
|
||||
|
||||
public LongFilter getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(LongFilter userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final UserRoleAssignmentCriteria that = (UserRoleAssignmentCriteria) o;
|
||||
return Objects.equals(id, that.id) &&
|
||||
Objects.equals(entityTypeId, that.entityTypeId) &&
|
||||
Objects.equals(entityObjectId, that.entityObjectId) &&
|
||||
Objects.equals(userId, that.userId) &&
|
||||
Objects.equals(assignedRole, that.assignedRole) &&
|
||||
Objects.equals(userId, that.userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
id,
|
||||
entityTypeId,
|
||||
entityObjectId,
|
||||
userId,
|
||||
assignedRole,
|
||||
userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserRoleAssignmentCriteria{" +
|
||||
(id != null ? "id=" + id + ", " : "") +
|
||||
(entityTypeId != null ? "entityTypeId=" + entityTypeId + ", " : "") +
|
||||
(entityObjectId != null ? "entityObjectId=" + entityObjectId + ", " : "") +
|
||||
(userId != null ? "userId=" + userId + ", " : "") +
|
||||
(assignedRole != null ? "assignedRole=" + assignedRole + ", " : "") +
|
||||
(userId != null ? "userId=" + userId + ", " : "") +
|
||||
"}";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
// Licensed under Apache-2.0
|
||||
package org.hostsharing.hsadminng.web.rest;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.UserRoleAssignment;
|
||||
import org.hostsharing.hsadminng.service.UserRoleAssignmentQueryService;
|
||||
import org.hostsharing.hsadminng.service.UserRoleAssignmentService;
|
||||
import org.hostsharing.hsadminng.service.dto.UserRoleAssignmentCriteria;
|
||||
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
|
||||
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
|
||||
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
|
||||
|
||||
import io.github.jhipster.web.util.ResponseUtil;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* REST controller for managing UserRoleAssignment.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class UserRoleAssignmentResource {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(UserRoleAssignmentResource.class);
|
||||
|
||||
private static final String ENTITY_NAME = "userRoleAssignment";
|
||||
|
||||
private final UserRoleAssignmentService userRoleAssignmentService;
|
||||
|
||||
private final UserRoleAssignmentQueryService userRoleAssignmentQueryService;
|
||||
|
||||
public UserRoleAssignmentResource(
|
||||
UserRoleAssignmentService userRoleAssignmentService,
|
||||
UserRoleAssignmentQueryService userRoleAssignmentQueryService) {
|
||||
this.userRoleAssignmentService = userRoleAssignmentService;
|
||||
this.userRoleAssignmentQueryService = userRoleAssignmentQueryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /user-role-assignments : Create a new userRoleAssignment.
|
||||
*
|
||||
* @param userRoleAssignment the userRoleAssignment to create
|
||||
* @return the ResponseEntity with status 201 (Created) and with body the new userRoleAssignment, or with status 400 (Bad
|
||||
* Request) if the userRoleAssignment has already an ID
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect
|
||||
*/
|
||||
@PostMapping("/user-role-assignments")
|
||||
public ResponseEntity<UserRoleAssignment> createUserRoleAssignment(
|
||||
@Valid @RequestBody UserRoleAssignment userRoleAssignment) throws URISyntaxException {
|
||||
log.debug("REST request to save UserRoleAssignment : {}", userRoleAssignment);
|
||||
if (userRoleAssignment.getId() != null) {
|
||||
throw new BadRequestAlertException("A new userRoleAssignment cannot already have an ID", ENTITY_NAME, "idexists");
|
||||
}
|
||||
UserRoleAssignment result = userRoleAssignmentService.save(userRoleAssignment);
|
||||
return ResponseEntity.created(new URI("/api/user-role-assignments/" + result.getId()))
|
||||
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
|
||||
.body(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT /user-role-assignments : Updates an existing userRoleAssignment.
|
||||
*
|
||||
* @param userRoleAssignment the userRoleAssignment to update
|
||||
* @return the ResponseEntity with status 200 (OK) and with body the updated userRoleAssignment,
|
||||
* or with status 400 (Bad Request) if the userRoleAssignment is not valid,
|
||||
* or with status 500 (Internal Server Error) if the userRoleAssignment couldn't be updated
|
||||
* @throws URISyntaxException if the Location URI syntax is incorrect
|
||||
*/
|
||||
@PutMapping("/user-role-assignments")
|
||||
public ResponseEntity<UserRoleAssignment> updateUserRoleAssignment(
|
||||
@Valid @RequestBody UserRoleAssignment userRoleAssignment) throws URISyntaxException {
|
||||
log.debug("REST request to update UserRoleAssignment : {}", userRoleAssignment);
|
||||
if (userRoleAssignment.getId() == null) {
|
||||
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
|
||||
}
|
||||
UserRoleAssignment result = userRoleAssignmentService.save(userRoleAssignment);
|
||||
return ResponseEntity.ok()
|
||||
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, userRoleAssignment.getId().toString()))
|
||||
.body(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user-role-assignments : get all the userRoleAssignments.
|
||||
*
|
||||
* @param pageable the pagination information
|
||||
* @param criteria the criterias which the requested entities should match
|
||||
* @return the ResponseEntity with status 200 (OK) and the list of userRoleAssignments in body
|
||||
*/
|
||||
@GetMapping("/user-role-assignments")
|
||||
public ResponseEntity<List<UserRoleAssignment>> getAllUserRoleAssignments(
|
||||
UserRoleAssignmentCriteria criteria,
|
||||
Pageable pageable) {
|
||||
log.debug("REST request to get UserRoleAssignments by criteria: {}", criteria);
|
||||
Page<UserRoleAssignment> page = userRoleAssignmentQueryService.findByCriteria(criteria, pageable);
|
||||
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/user-role-assignments");
|
||||
return ResponseEntity.ok().headers(headers).body(page.getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user-role-assignments/count : count all the userRoleAssignments.
|
||||
*
|
||||
* @param criteria the criterias which the requested entities should match
|
||||
* @return the ResponseEntity with status 200 (OK) and the count in body
|
||||
*/
|
||||
@GetMapping("/user-role-assignments/count")
|
||||
public ResponseEntity<Long> countUserRoleAssignments(UserRoleAssignmentCriteria criteria) {
|
||||
log.debug("REST request to count UserRoleAssignments by criteria: {}", criteria);
|
||||
return ResponseEntity.ok().body(userRoleAssignmentQueryService.countByCriteria(criteria));
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /user-role-assignments/:id : get the "id" userRoleAssignment.
|
||||
*
|
||||
* @param id the id of the userRoleAssignment to retrieve
|
||||
* @return the ResponseEntity with status 200 (OK) and with body the userRoleAssignment, or with status 404 (Not Found)
|
||||
*/
|
||||
@GetMapping("/user-role-assignments/{id}")
|
||||
public ResponseEntity<UserRoleAssignment> getUserRoleAssignment(@PathVariable Long id) {
|
||||
log.debug("REST request to get UserRoleAssignment : {}", id);
|
||||
Optional<UserRoleAssignment> userRoleAssignment = userRoleAssignmentService.findOne(id);
|
||||
return ResponseUtil.wrapOrNotFound(userRoleAssignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE /user-role-assignments/:id : delete the "id" userRoleAssignment.
|
||||
*
|
||||
* @param id the id of the userRoleAssignment to delete
|
||||
* @return the ResponseEntity with status 200 (OK)
|
||||
*/
|
||||
@DeleteMapping("/user-role-assignments/{id}")
|
||||
public ResponseEntity<Void> deleteUserRoleAssignment(@PathVariable Long id) {
|
||||
log.debug("REST request to delete UserRoleAssignment : {}", id);
|
||||
userRoleAssignmentService.delete(id);
|
||||
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
|
||||
}
|
||||
}
|
24
src/main/jdl/accessrights.jdl
Normal file
24
src/main/jdl/accessrights.jdl
Normal file
@ -0,0 +1,24 @@
|
||||
filter all
|
||||
paginate all with infinite-scroll
|
||||
|
||||
enum UserRole {
|
||||
HOSTMASTER,
|
||||
ADMIN,
|
||||
SUPPORTER,
|
||||
CONTRACTUAL_CONTACT,
|
||||
FINANCIAL_CONTACT,
|
||||
TECHNICAL_CONTACT,
|
||||
CUSTOMER_USER
|
||||
}
|
||||
|
||||
entity UserRoleAssignment {
|
||||
entityTypeId String,
|
||||
entityObjectId Long,
|
||||
userId Long required,
|
||||
assignedRole UserRole required
|
||||
}
|
||||
|
||||
|
||||
relationship ManyToOne {
|
||||
UserRoleAssignment{user(login)} to User{required},
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
<!--
|
||||
Added the entity Customer.
|
||||
-->
|
||||
<changeSet id="20190430150324-1" author="jhipster">
|
||||
<changeSet id="20190430152136-1" author="jhipster">
|
||||
<createTable tableName="customer">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
@ -14,7 +14,7 @@
|
||||
<!--
|
||||
Added the entity Membership.
|
||||
-->
|
||||
<changeSet id="20190430150325-1" author="jhipster">
|
||||
<changeSet id="20190430152137-1" author="jhipster">
|
||||
<createTable tableName="membership">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
@ -6,7 +6,7 @@
|
||||
<!--
|
||||
Added the constraints for entity Membership.
|
||||
-->
|
||||
<changeSet id="20190430150325-2" author="jhipster">
|
||||
<changeSet id="20190430152137-2" author="jhipster">
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="customer_id"
|
||||
baseTableName="membership"
|
@ -14,7 +14,7 @@
|
||||
<!--
|
||||
Added the entity Share.
|
||||
-->
|
||||
<changeSet id="20190430150326-1" author="jhipster">
|
||||
<changeSet id="20190430152138-1" author="jhipster">
|
||||
<createTable tableName="share">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
@ -6,7 +6,7 @@
|
||||
<!--
|
||||
Added the constraints for entity Share.
|
||||
-->
|
||||
<changeSet id="20190430150326-2" author="jhipster">
|
||||
<changeSet id="20190430152138-2" author="jhipster">
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="membership_id"
|
||||
baseTableName="share"
|
@ -14,7 +14,7 @@
|
||||
<!--
|
||||
Added the entity Asset.
|
||||
-->
|
||||
<changeSet id="20190430150327-1" author="jhipster">
|
||||
<changeSet id="20190430152139-1" author="jhipster">
|
||||
<createTable tableName="asset">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
@ -6,7 +6,7 @@
|
||||
<!--
|
||||
Added the constraints for entity Asset.
|
||||
-->
|
||||
<changeSet id="20190430150327-2" author="jhipster">
|
||||
<changeSet id="20190430152139-2" author="jhipster">
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="membership_id"
|
||||
baseTableName="asset"
|
@ -14,7 +14,7 @@
|
||||
<!--
|
||||
Added the entity SepaMandate.
|
||||
-->
|
||||
<changeSet id="20190430150328-1" author="jhipster">
|
||||
<changeSet id="20190430152140-1" author="jhipster">
|
||||
<createTable tableName="sepa_mandate">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
@ -6,7 +6,7 @@
|
||||
<!--
|
||||
Added the constraints for entity SepaMandate.
|
||||
-->
|
||||
<changeSet id="20190430150328-2" author="jhipster">
|
||||
<changeSet id="20190430152140-2" author="jhipster">
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="customer_id"
|
||||
baseTableName="sepa_mandate"
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<property name="now" value="now()" dbms="h2"/>
|
||||
|
||||
<property name="now" value="current_timestamp" dbms="postgresql"/>
|
||||
|
||||
<property name="floatType" value="float4" dbms="postgresql, h2"/>
|
||||
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
|
||||
|
||||
<!--
|
||||
Added the entity UserRoleAssignment.
|
||||
-->
|
||||
<changeSet id="20190430152204-1" author="jhipster">
|
||||
<createTable tableName="user_role_assignment">
|
||||
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
||||
</column>
|
||||
<column name="entity_type_id" type="varchar(255)">
|
||||
<constraints nullable="true" />
|
||||
</column>
|
||||
|
||||
<column name="entity_object_id" type="bigint">
|
||||
<constraints nullable="true" />
|
||||
</column>
|
||||
|
||||
<column name="user_id" type="bigint">
|
||||
<constraints nullable="false" />
|
||||
</column>
|
||||
|
||||
<column name="assigned_role" type="varchar(255)">
|
||||
<constraints nullable="false" />
|
||||
</column>
|
||||
|
||||
<column name="user_id" type="bigint">
|
||||
<constraints nullable="true" />
|
||||
</column>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
|
||||
</databaseChangeLog>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
|
||||
<!--
|
||||
Added the constraints for entity UserRoleAssignment.
|
||||
-->
|
||||
<changeSet id="20190430152204-2" author="jhipster">
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="user_id"
|
||||
baseTableName="user_role_assignment"
|
||||
constraintName="fk_user_role_assignment_user_id"
|
||||
referencedColumnNames="id"
|
||||
referencedTableName="jhi_user"/>
|
||||
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -5,16 +5,18 @@
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
|
||||
|
||||
<include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150324_added_entity_Customer.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150325_added_entity_Membership.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150326_added_entity_Share.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150327_added_entity_Asset.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150328_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152136_added_entity_Customer.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152137_added_entity_Membership.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152138_added_entity_Share.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152139_added_entity_Asset.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152140_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152204_added_entity_UserRoleAssignment.xml" relativeToChangelogFile="false"/>
|
||||
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
|
||||
<include file="config/liquibase/changelog/20190430150325_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150326_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150327_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430150328_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152137_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152138_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152139_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152140_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
|
||||
<include file="config/liquibase/changelog/20190430152204_added_entity_constraints_UserRoleAssignment.xml" relativeToChangelogFile="false"/>
|
||||
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
|
||||
|
||||
<!-- sample data -->
|
||||
|
@ -23,6 +23,10 @@ import { RouterModule } from '@angular/router';
|
||||
{
|
||||
path: 'sepa-mandate',
|
||||
loadChildren: './sepa-mandate/sepa-mandate.module#HsadminNgSepaMandateModule'
|
||||
},
|
||||
{
|
||||
path: 'user-role-assignment',
|
||||
loadChildren: './user-role-assignment/user-role-assignment.module#HsadminNgUserRoleAssignmentModule'
|
||||
}
|
||||
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
|
||||
])
|
||||
|
@ -0,0 +1,6 @@
|
||||
export * from './user-role-assignment.service';
|
||||
export * from './user-role-assignment-update.component';
|
||||
export * from './user-role-assignment-delete-dialog.component';
|
||||
export * from './user-role-assignment-detail.component';
|
||||
export * from './user-role-assignment.component';
|
||||
export * from './user-role-assignment.route';
|
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(userRoleAssignment.id)">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
|
||||
(click)="clear()">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<p id="jhi-delete-userRoleAssignment-heading" jhiTranslate="hsadminNgApp.userRoleAssignment.delete.question" [translateValues]="{id: userRoleAssignment.id}">Are you sure you want to delete this User Role Assignment?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
|
||||
<fa-icon [icon]="'ban'"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button id="jhi-confirm-delete-userRoleAssignment" type="submit" class="btn btn-danger">
|
||||
<fa-icon [icon]="'times'"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,72 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { JhiEventManager } from 'ng-jhipster';
|
||||
|
||||
import { IUserRoleAssignment } from 'app/shared/model/user-role-assignment.model';
|
||||
import { UserRoleAssignmentService } from './user-role-assignment.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-user-role-assignment-delete-dialog',
|
||||
templateUrl: './user-role-assignment-delete-dialog.component.html'
|
||||
})
|
||||
export class UserRoleAssignmentDeleteDialogComponent {
|
||||
userRoleAssignment: IUserRoleAssignment;
|
||||
|
||||
constructor(
|
||||
protected userRoleAssignmentService: UserRoleAssignmentService,
|
||||
public activeModal: NgbActiveModal,
|
||||
protected eventManager: JhiEventManager
|
||||
) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.userRoleAssignmentService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'userRoleAssignmentListModification',
|
||||
content: 'Deleted an userRoleAssignment'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-user-role-assignment-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class UserRoleAssignmentDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ userRoleAssignment }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(UserRoleAssignmentDeleteDialogComponent as Component, {
|
||||
size: 'lg',
|
||||
backdrop: 'static'
|
||||
});
|
||||
this.ngbModalRef.componentInstance.userRoleAssignment = userRoleAssignment;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/user-role-assignment', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/user-role-assignment', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="userRoleAssignment">
|
||||
<h2><span jhiTranslate="hsadminNgApp.userRoleAssignment.detail.title">User Role Assignment</span> {{userRoleAssignment.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.userRoleAssignment.entityTypeId">Entity Type Id</span></dt>
|
||||
<dd>
|
||||
<span>{{userRoleAssignment.entityTypeId}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.userRoleAssignment.entityObjectId">Entity Object Id</span></dt>
|
||||
<dd>
|
||||
<span>{{userRoleAssignment.entityObjectId}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.userRoleAssignment.userId">User Id</span></dt>
|
||||
<dd>
|
||||
<span>{{userRoleAssignment.userId}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.userRoleAssignment.assignedRole">Assigned Role</span></dt>
|
||||
<dd>
|
||||
<span jhiTranslate="{{'hsadminNgApp.UserRole.' + userRoleAssignment.assignedRole}}">{{userRoleAssignment.assignedRole}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.userRoleAssignment.user">User</span></dt>
|
||||
<dd>
|
||||
{{userRoleAssignment.user?.login}}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<button type="submit"
|
||||
(click)="previousState()"
|
||||
class="btn btn-info">
|
||||
<fa-icon [icon]="'arrow-left'"></fa-icon> <span jhiTranslate="entity.action.back"> Back</span>
|
||||
</button>
|
||||
|
||||
<button type="button"
|
||||
[routerLink]="['/user-role-assignment', userRoleAssignment.id, 'edit']"
|
||||
class="btn btn-primary">
|
||||
<fa-icon [icon]="'pencil-alt'"></fa-icon> <span jhiTranslate="entity.action.edit"> Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { IUserRoleAssignment } from 'app/shared/model/user-role-assignment.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-user-role-assignment-detail',
|
||||
templateUrl: './user-role-assignment-detail.component.html'
|
||||
})
|
||||
export class UserRoleAssignmentDetailComponent implements OnInit {
|
||||
userRoleAssignment: IUserRoleAssignment;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ userRoleAssignment }) => {
|
||||
this.userRoleAssignment = userRoleAssignment;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-user-role-assignment-heading" jhiTranslate="hsadminNgApp.userRoleAssignment.home.createOrEditLabel">Create or edit a User Role Assignment</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!userRoleAssignment.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="userRoleAssignment.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityTypeId" for="field_entityTypeId">Entity Type Id</label>
|
||||
<input type="text" class="form-control" name="entityTypeId" id="field_entityTypeId"
|
||||
[(ngModel)]="userRoleAssignment.entityTypeId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityObjectId" for="field_entityObjectId">Entity Object Id</label>
|
||||
<input type="number" class="form-control" name="entityObjectId" id="field_entityObjectId"
|
||||
[(ngModel)]="userRoleAssignment.entityObjectId" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.userId" for="field_userId">User Id</label>
|
||||
<input type="number" class="form-control" name="userId" id="field_userId"
|
||||
[(ngModel)]="userRoleAssignment.userId" required/>
|
||||
<div [hidden]="!(editForm.controls.userId?.dirty && editForm.controls.userId?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.userId?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.userId?.errors?.number" jhiTranslate="entity.validation.number">
|
||||
This field should be a number.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.assignedRole" for="field_assignedRole">Assigned Role</label>
|
||||
<select class="form-control" name="assignedRole" [(ngModel)]="userRoleAssignment.assignedRole" id="field_assignedRole" required>
|
||||
<option value="HOSTMASTER">{{'hsadminNgApp.UserRole.HOSTMASTER' | translate}}</option>
|
||||
<option value="ADMIN">{{'hsadminNgApp.UserRole.ADMIN' | translate}}</option>
|
||||
<option value="SUPPORTER">{{'hsadminNgApp.UserRole.SUPPORTER' | translate}}</option>
|
||||
<option value="CONTRACTUAL_CONTACT">{{'hsadminNgApp.UserRole.CONTRACTUAL_CONTACT' | translate}}</option>
|
||||
<option value="FINANCIAL_CONTACT">{{'hsadminNgApp.UserRole.FINANCIAL_CONTACT' | translate}}</option>
|
||||
<option value="TECHNICAL_CONTACT">{{'hsadminNgApp.UserRole.TECHNICAL_CONTACT' | translate}}</option>
|
||||
<option value="CUSTOMER_USER">{{'hsadminNgApp.UserRole.CUSTOMER_USER' | translate}}</option>
|
||||
</select>
|
||||
<div [hidden]="!(editForm.controls.assignedRole?.dirty && editForm.controls.assignedRole?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.assignedRole?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.user" for="field_user">User</label>
|
||||
<select class="form-control" id="field_user" name="user" [(ngModel)]="userRoleAssignment.user" >
|
||||
<option [ngValue]="null"></option>
|
||||
<option [ngValue]="userOption.id === userRoleAssignment.user?.id ? userRoleAssignment.user : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.login}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
|
||||
<fa-icon [icon]="'ban'"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
|
||||
<fa-icon [icon]="'save'"></fa-icon> <span jhiTranslate="entity.action.save">Save</span>
|
||||