Compare commits
3 Commits
develop
...
feature/co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96403edecb | ||
|
|
af1cdad171 | ||
|
|
76a07b2f5a |
@@ -2,18 +2,22 @@ package de.ul.swtp.modules.contactmanagement;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import de.ul.swtp.modules.contactmanagement.contactdetails.Address;
|
||||||
|
import de.ul.swtp.modules.contactmanagement.contactdetails.BankAccount;
|
||||||
|
import de.ul.swtp.modules.contactmanagement.contactdetails.VoluntaryDetails;
|
||||||
import de.ul.swtp.system.User;
|
import de.ul.swtp.system.User;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "mv_cm_contacts")
|
@Table(name = "cm_contacts")
|
||||||
@Data
|
@Data
|
||||||
@JsonIdentityInfo(
|
@JsonIdentityInfo(
|
||||||
generator = ObjectIdGenerators.PropertyGenerator.class,
|
generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||||
@@ -22,32 +26,36 @@ import java.util.List;
|
|||||||
resolver = ContactIdResolver.class)
|
resolver = ContactIdResolver.class)
|
||||||
public class Contact implements Serializable {
|
public class Contact implements Serializable {
|
||||||
|
|
||||||
//@Null may well not work here, if the validations are call on update as well as create
|
|
||||||
//@Null
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// perhaps we need a @NotBlank here? Are emails obligatory?
|
|
||||||
@Email(regexp = "^.*@.*\\..*")
|
@Email(regexp = "^.*@.*\\..*")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@javax.validation.constraints.NotBlank
|
@NotBlank
|
||||||
private String firstName;
|
private String firstName;
|
||||||
|
|
||||||
@javax.validation.constraints.NotBlank
|
@NotBlank
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
|
@DateTimeFormat
|
||||||
|
private Date dateOfBirth;
|
||||||
|
|
||||||
//TODO: write regex (or custom validator) for phone numbers
|
//TODO: write regex (or custom validator) for phone numbers
|
||||||
//@Pattern(regexp = )
|
//@Pattern(regexp = )
|
||||||
// Note: phone numbers are currently optional
|
// Note: phone numbers are currently optional
|
||||||
@Digits(integer = 16, fraction = 0)
|
@Digits(integer = 16, fraction = 0)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@javax.validation.constraints.NotBlank
|
@OneToOne
|
||||||
private String address;
|
private Address address;
|
||||||
|
|
||||||
private String bankDetails;
|
@OneToOne
|
||||||
|
private BankAccount bankAccount;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
private VoluntaryDetails voluntaryDetails;
|
||||||
|
|
||||||
@ManyToMany(mappedBy = "contacts", fetch = FetchType.LAZY)
|
@ManyToMany(mappedBy = "contacts", fetch = FetchType.LAZY)
|
||||||
@JsonIdentityReference(alwaysAsId = true)
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
@@ -58,7 +66,4 @@ public class Contact implements Serializable {
|
|||||||
//@JsonIgnore
|
//@JsonIgnore
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "Contact(id=" + this.getId() + ", email=" + this.getEmail() + ", firstName=" + this.getFirstName() + ", lastName=" + this.getLastName() + ", phone=" + this.getPhone() + ", address=" + this.getAddress() + ", bankDetails=" + this.getBankDetails() + ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class ContactManagerImpl implements ContactManager {
|
|||||||
if (contact.getLastName() != null) contactToBeUpdated.setLastName(contact.getLastName());
|
if (contact.getLastName() != null) contactToBeUpdated.setLastName(contact.getLastName());
|
||||||
if (contact.getPhone() != null) contactToBeUpdated.setPhone(contact.getPhone());
|
if (contact.getPhone() != null) contactToBeUpdated.setPhone(contact.getPhone());
|
||||||
if (contact.getAddress() != null) contactToBeUpdated.setAddress(contact.getAddress());
|
if (contact.getAddress() != null) contactToBeUpdated.setAddress(contact.getAddress());
|
||||||
if (contact.getBankDetails() != null) contactToBeUpdated.setBankDetails(contact.getBankDetails());
|
if (contact.getBankAccount() != null) contactToBeUpdated.setBankAccount(contact.getBankAccount());
|
||||||
if (contact.getGroups() != null) contactToBeUpdated.setGroups(contact.getGroups());
|
if (contact.getGroups() != null) contactToBeUpdated.setGroups(contact.getGroups());
|
||||||
//Only do something when contact.getUser() != null
|
//Only do something when contact.getUser() != null
|
||||||
//Delete relation when user.getContact().getId() is 0.
|
//Delete relation when user.getContact().getId() is 0.
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package de.ul.swtp.modules.contactmanagement.contactdetails;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "cm_address")
|
||||||
|
@Data
|
||||||
|
public class Address implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String street;
|
||||||
|
private Long zipCode;
|
||||||
|
private String city;
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package de.ul.swtp.modules.contactmanagement.contactdetails;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "cm_bankdetails")
|
||||||
|
@Data
|
||||||
|
public class BankAccount implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String accountOwner;
|
||||||
|
private String iban;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package de.ul.swtp.modules.contactmanagement.contactdetails;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "cm_voluntarydetails")
|
||||||
|
@Data
|
||||||
|
public class VoluntaryDetails implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String profession;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ public class JavaMailSenderConfig {
|
|||||||
public JavaMailSender javaMailSender() {
|
public JavaMailSender javaMailSender() {
|
||||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||||
javaMailSender.setHost("");
|
javaMailSender.setHost("");
|
||||||
javaMailSender.setPort();
|
javaMailSender.setPort(21);
|
||||||
javaMailSender.setUsername("");
|
javaMailSender.setUsername("");
|
||||||
javaMailSender.setPassword("");
|
javaMailSender.setPassword("");
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(WebSecurity web) throws Exception {
|
public void configure(WebSecurity web) {
|
||||||
// AuthenticationTokenFilter will ignore the below paths
|
// AuthenticationTokenFilter will ignore the below paths
|
||||||
web
|
web
|
||||||
.ignoring()
|
.ignoring()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class CustomJdbcMutableAclService extends JdbcMutableAclService {
|
|||||||
System.out.println("Group name: " + groupName);
|
System.out.println("Group name: " + groupName);
|
||||||
String createGrantedAuthoritySidForGroup = "INSERT INTO acl_sid (principal, sid) VALUES (FALSE, ?)";
|
String createGrantedAuthoritySidForGroup = "INSERT INTO acl_sid (principal, sid) VALUES (FALSE, ?)";
|
||||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||||
PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(createGrantedAuthoritySidForGroup, new int[]{Types.VARCHAR});
|
PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(createGrantedAuthoritySidForGroup, Types.VARCHAR);
|
||||||
factory.setReturnGeneratedKeys(true);
|
factory.setReturnGeneratedKeys(true);
|
||||||
jdbcTemplate.update(factory.newPreparedStatementCreator(new Object[]{groupName}), keyHolder);
|
jdbcTemplate.update(factory.newPreparedStatementCreator(new Object[]{groupName}), keyHolder);
|
||||||
System.out.println("keyHolder: " + keyHolder.getKey());
|
System.out.println("keyHolder: " + keyHolder.getKey());
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import lombok.Data;
|
|||||||
import org.hibernate.annotations.LazyCollection;
|
import org.hibernate.annotations.LazyCollection;
|
||||||
import org.hibernate.annotations.LazyCollectionOption;
|
import org.hibernate.annotations.LazyCollectionOption;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@@ -38,7 +37,7 @@ public class User {
|
|||||||
|
|
||||||
//The regex ensures that only emails with top level domains are accepted (note that local email addresses are actually valid but of little use to us)
|
//The regex ensures that only emails with top level domains are accepted (note that local email addresses are actually valid but of little use to us)
|
||||||
@Email(regexp="^.*@.*\\..*")
|
@Email(regexp="^.*@.*\\..*")
|
||||||
@javax.validation.constraints.NotBlank
|
@NotBlank
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Length(min=4, max=256)
|
@Length(min=4, max=256)
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ mv.email.from=mv@felixfoertsch.de
|
|||||||
mv.email.subject-prefix="[MV] "
|
mv.email.subject-prefix="[MV] "
|
||||||
|
|
||||||
mv.signup.expiration=604800
|
mv.signup.expiration=604800
|
||||||
mv.signup.email-subject:Aktivieren Sie Ihren Account
|
mv.signup.email-subject=Aktivieren Sie Ihren Account
|
||||||
@@ -45,14 +45,35 @@ CREATE TABLE acl_entry (
|
|||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
-- MV TABLES
|
-- MV TABLES
|
||||||
CREATE TABLE mv_cm_contacts (
|
CREATE TABLE cm_address (
|
||||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
email VARCHAR(255) UNIQUE,
|
street VARCHAR(255),
|
||||||
first_name VARCHAR(255),
|
zip_code BIGINT(255),
|
||||||
last_name VARCHAR(255),
|
city VARCHAR(255),
|
||||||
phone VARCHAR(255),
|
country VARCHAR(255)
|
||||||
address VARCHAR(255),
|
);
|
||||||
bank_details VARCHAR(255)
|
|
||||||
|
CREATE TABLE cm_voluntarydetails (
|
||||||
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
profession VARCHAR(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE cm_bankdetails (
|
||||||
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
account_owner VARCHAR(255),
|
||||||
|
iban VARCHAR(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE cm_contacts (
|
||||||
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
email VARCHAR(255) UNIQUE,
|
||||||
|
first_name VARCHAR(255),
|
||||||
|
last_name VARCHAR(255),
|
||||||
|
phone VARCHAR(255),
|
||||||
|
date_of_birth TIMESTAMP,
|
||||||
|
address_id BIGINT UNSIGNED NOT NULL REFERENCES cm_address (id),
|
||||||
|
bank_account_id BIGINT UNSIGNED NOT NULL REFERENCES cm_bankdetails (id),
|
||||||
|
voluntary_details_id BIGINT UNSIGNED REFERENCES cm_voluntarydetails (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE mv_cm_groups (
|
CREATE TABLE mv_cm_groups (
|
||||||
@@ -72,7 +93,7 @@ CREATE TABLE mv_users (
|
|||||||
last_password_reset_date TIMESTAMP,
|
last_password_reset_date TIMESTAMP,
|
||||||
username VARCHAR(255) UNIQUE NOT NULL,
|
username VARCHAR(255) UNIQUE NOT NULL,
|
||||||
password VARCHAR(255),
|
password VARCHAR(255),
|
||||||
contact_id BIGINT UNIQUE REFERENCES mv_cm_contacts (id)
|
contact_id BIGINT UNIQUE REFERENCES cm_contacts (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE mv_users_email_verification_token (
|
CREATE TABLE mv_users_email_verification_token (
|
||||||
@@ -116,81 +137,81 @@ CREATE TABLE mv_user_role (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE mv_group_contact (
|
CREATE TABLE mv_group_contact (
|
||||||
group_id BIGINT NOT NULL REFERENCES mv_cm_groups (id)
|
group_id BIGINT NOT NULL REFERENCES mv_cm_groups (id)
|
||||||
ON DELETE CASCADE,
|
ON DELETE CASCADE,
|
||||||
contact_id BIGINT NOT NULL REFERENCES mv_cm_contacts (id)
|
contact_id BIGINT NOT NULL REFERENCES cm_contacts (id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE mv_group_contact_responsible (
|
CREATE TABLE mv_group_contact_responsible (
|
||||||
group_id BIGINT NOT NULL REFERENCES mv_cm_groups (id)
|
group_id BIGINT NOT NULL REFERENCES mv_cm_groups (id)
|
||||||
ON DELETE CASCADE,
|
ON DELETE CASCADE,
|
||||||
contact_id BIGINT NOT NULL REFERENCES mv_cm_contacts (id)
|
contact_id BIGINT NOT NULL REFERENCES cm_contacts (id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO acl_sid (principal, sid) VALUES
|
INSERT INTO acl_sid (principal, sid)
|
||||||
(FALSE, 'ROLE_ADMIN'),
|
VALUES (FALSE, 'ROLE_ADMIN'),
|
||||||
(FALSE, 'ROLE_USER');
|
(FALSE, 'ROLE_USER');
|
||||||
|
|
||||||
INSERT INTO mv_authorities (name) VALUES
|
INSERT INTO mv_authorities (name)
|
||||||
('ROLE_ADMIN'),
|
VALUES ('ROLE_ADMIN'),
|
||||||
('ROLE_USER'),
|
('ROLE_USER'),
|
||||||
-- SYSTEM AUTHORITIES
|
-- SYSTEM AUTHORITIES
|
||||||
-- USER
|
-- USER
|
||||||
('SYS_USER_GETALL'),
|
('SYS_USER_GETALL'),
|
||||||
('SYS_USER_GETUSERBYID'),
|
('SYS_USER_GETUSERBYID'),
|
||||||
('SYS_USER_GETUSERSBYIDS'),
|
('SYS_USER_GETUSERSBYIDS'),
|
||||||
('SYS_USER_GETUSERBYUSERNAME'),
|
('SYS_USER_GETUSERBYUSERNAME'),
|
||||||
('SYS_USER_GETALLBYROLE'),
|
('SYS_USER_GETALLBYROLE'),
|
||||||
('SYS_USER_GETALLBYGROUP'),
|
('SYS_USER_GETALLBYGROUP'),
|
||||||
('SYS_USER_CREATE'),
|
('SYS_USER_CREATE'),
|
||||||
('SYS_USER_UPDATE'),
|
('SYS_USER_UPDATE'),
|
||||||
('SYS_USER_DELETE'),
|
('SYS_USER_DELETE'),
|
||||||
-- ROLE
|
-- ROLE
|
||||||
('SYS_ROLE_CREATE'),
|
('SYS_ROLE_CREATE'),
|
||||||
('SYS_ROLE_GETROLEBYID'),
|
('SYS_ROLE_GETROLEBYID'),
|
||||||
('SYS_ROLE_GETROLESBYIDS'),
|
('SYS_ROLE_GETROLESBYIDS'),
|
||||||
('SYS_ROLE_GETALL'),
|
('SYS_ROLE_GETALL'),
|
||||||
('SYS_ROLE_FINDUSERSINROLE'),
|
('SYS_ROLE_FINDUSERSINROLE'),
|
||||||
('SYS_ROLE_UPDATE'),
|
('SYS_ROLE_UPDATE'),
|
||||||
('SYS_ROLE_DELETE'),
|
('SYS_ROLE_DELETE'),
|
||||||
('SYS_ROLE_ADDUSERTOROLE'),
|
('SYS_ROLE_ADDUSERTOROLE'),
|
||||||
('SYS_ROLE_ADDUSERSTOROLE'),
|
('SYS_ROLE_ADDUSERSTOROLE'),
|
||||||
('SYS_ROLE_REMOVEUSERFROMROLE'),
|
('SYS_ROLE_REMOVEUSERFROMROLE'),
|
||||||
('SYS_ROLE_REMOVEUSERSFROMROLE'),
|
('SYS_ROLE_REMOVEUSERSFROMROLE'),
|
||||||
('SYS_ROLE_REMOVEALLUSERSFROMROLE'),
|
('SYS_ROLE_REMOVEALLUSERSFROMROLE'),
|
||||||
('SYS_ROLE_ADDAUTHORITYTOROLE'),
|
('SYS_ROLE_ADDAUTHORITYTOROLE'),
|
||||||
('SYS_ROLE_ADDAUTHORITIESTOROLE'),
|
('SYS_ROLE_ADDAUTHORITIESTOROLE'),
|
||||||
('SYS_ROLE_REMOVEAUTHORITYFROMROLE'),
|
('SYS_ROLE_REMOVEAUTHORITYFROMROLE'),
|
||||||
('SYS_ROLE_REMOVEAUTHORITIESFROMROLE'),
|
('SYS_ROLE_REMOVEAUTHORITIESFROMROLE'),
|
||||||
-- CONTACTMANAGEMENT AUTHORITIES
|
-- CONTACTMANAGEMENT AUTHORITIES
|
||||||
-- CONTACT
|
-- CONTACT
|
||||||
('CM_CONTACT_CREATE'),
|
('CM_CONTACT_CREATE'),
|
||||||
('CM_CONTACT_GETCONTACTBYID'),
|
('CM_CONTACT_GETCONTACTBYID'),
|
||||||
('CM_CONTACT_UPDATE'),
|
('CM_CONTACT_UPDATE'),
|
||||||
('CM_CONTACT_DELETE'),
|
('CM_CONTACT_DELETE'),
|
||||||
('CM_CONTACT_ADDPERMISSIONTOGROUP'),
|
('CM_CONTACT_ADDPERMISSIONTOGROUP'),
|
||||||
('CM_CONTACT_ADDPERMISSIONTOGROUPS'),
|
('CM_CONTACT_ADDPERMISSIONTOGROUPS'),
|
||||||
('CM_CONTACT_GETALL'),
|
('CM_CONTACT_GETALL'),
|
||||||
('CM_CONTACT_GETCONTACTSBYIDS'),
|
('CM_CONTACT_GETCONTACTSBYIDS'),
|
||||||
-- GROUP
|
-- GROUP
|
||||||
('CM_GROUP_CREATE'),
|
('CM_GROUP_CREATE'),
|
||||||
('CM_GROUP_GETGROUPBYID'),
|
('CM_GROUP_GETGROUPBYID'),
|
||||||
('CM_GROUP_GETGROUPSBYIDS'),
|
('CM_GROUP_GETGROUPSBYIDS'),
|
||||||
('CM_GROUP_GETALL'),
|
('CM_GROUP_GETALL'),
|
||||||
('CM_GROUP_GETALLBYCONTACTS'),
|
('CM_GROUP_GETALLBYCONTACTS'),
|
||||||
('CM_GROUP_FINDUSERSINGROUP'),
|
('CM_GROUP_FINDUSERSINGROUP'),
|
||||||
('CM_GROUP_UPDATE'),
|
('CM_GROUP_UPDATE'),
|
||||||
('CM_GROUP_DELETE'),
|
('CM_GROUP_DELETE'),
|
||||||
('CM_GROUP_ADDUSERTOGROUP'),
|
('CM_GROUP_ADDUSERTOGROUP'),
|
||||||
('CM_GROUP_ADDUSERSTOGROUP'),
|
('CM_GROUP_ADDUSERSTOGROUP'),
|
||||||
('CM_GROUP_REMOVEUSERFROMGROUP'),
|
('CM_GROUP_REMOVEUSERFROMGROUP'),
|
||||||
('CM_GROUP_REMOVEUSERSFROMGROUP'),
|
('CM_GROUP_REMOVEUSERSFROMGROUP'),
|
||||||
('CM_GROUP_ADDAUTHORITYTOGROUP'),
|
('CM_GROUP_ADDAUTHORITYTOGROUP'),
|
||||||
('CM_GROUP_ADDAUTHORITIESTOGROUP'),
|
('CM_GROUP_ADDAUTHORITIESTOGROUP'),
|
||||||
('CM_GROUP_REMOVEAUTHORITYFROMGROUP'),
|
('CM_GROUP_REMOVEAUTHORITYFROMGROUP'),
|
||||||
('CM_GROUP_REMOVEAUTHORITIESFROMGROUP');
|
('CM_GROUP_REMOVEAUTHORITIESFROMGROUP');
|
||||||
|
|
||||||
-- Create one user object as the first user, called admin
|
-- Create one user object as the first user, called admin
|
||||||
INSERT INTO mv_users (admin, enabled, account_non_expired, account_non_locked, credentials_non_expired, username, last_password_reset_date, password)
|
INSERT INTO mv_users (admin, enabled, account_non_expired, account_non_locked, credentials_non_expired, username, last_password_reset_date, password)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// VARIABLES =============================================================
|
// VARIABLES =============================================================
|
||||||
var TOKEN_KEY = "jwtToken"
|
var TOKEN_KEY = "jwtToken";
|
||||||
var $notLoggedIn = $("#notLoggedIn");
|
var $notLoggedIn = $("#notLoggedIn");
|
||||||
var $loggedIn = $("#loggedIn").hide();
|
var $loggedIn = $("#loggedIn").hide();
|
||||||
var $loggedInBody = $("#loggedInBody");
|
var $loggedInBody = $("#loggedInBody");
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ContactControllerTest {
|
|||||||
@Autowired private ContactRepository contactRepository;
|
@Autowired private ContactRepository contactRepository;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
//create sample contacts
|
//create sample contacts
|
||||||
for(int i = 1; i < 10; ++i){
|
for(int i = 1; i < 10; ++i){
|
||||||
Contact contact = new Contact();
|
Contact contact = new Contact();
|
||||||
@@ -45,8 +45,6 @@ public class ContactControllerTest {
|
|||||||
contact.setFirstName("Max");
|
contact.setFirstName("Max");
|
||||||
contact.setLastName("Musterkontakt");
|
contact.setLastName("Musterkontakt");
|
||||||
contact.setPhone("017612"+i+"678");
|
contact.setPhone("017612"+i+"678");
|
||||||
contact.setAddress("Musterkontaktstr. "+i);
|
|
||||||
contact.setBankDetails("Musterbank " + i);
|
|
||||||
|
|
||||||
contactRepository.save(contact);
|
contactRepository.save(contact);
|
||||||
}
|
}
|
||||||
@@ -80,7 +78,7 @@ public class ContactControllerTest {
|
|||||||
" \"lastName\": \""+lastName+"\",\n" +
|
" \"lastName\": \""+lastName+"\",\n" +
|
||||||
" \"phone\": \""+phone+"\",\n" +
|
" \"phone\": \""+phone+"\",\n" +
|
||||||
" \"address\": \""+address+"\",\n" +
|
" \"address\": \""+address+"\",\n" +
|
||||||
" \"bankDetails\": \""+bankDetails+"\",\n" +
|
" \"bankAccount\": \""+bankDetails+"\",\n" +
|
||||||
" \"groups\": null\n" +
|
" \"groups\": null\n" +
|
||||||
"}";
|
"}";
|
||||||
//add user
|
//add user
|
||||||
@@ -175,7 +173,7 @@ public class ContactControllerTest {
|
|||||||
|
|
||||||
//checks every field that should be implemented according to yml
|
//checks every field that should be implemented according to yml
|
||||||
String[] fields = {
|
String[] fields = {
|
||||||
"id", "email", "firstName", "lastName", "phone", "address", "bankDetails"
|
"id", "email", "firstName", "lastName", "phone", "address", "bankAccount"
|
||||||
};
|
};
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ContactTest {
|
|||||||
public void testSetUp(){
|
public void testSetUp(){
|
||||||
testContact.setFirstName("validFirstName");
|
testContact.setFirstName("validFirstName");
|
||||||
testContact.setLastName("validLastName");
|
testContact.setLastName("validLastName");
|
||||||
testContact.setAddress("Teststr. 12 04123 Leipzig");
|
// testContact.setAddress("Teststr. 12 04123 Leipzig");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -274,7 +274,7 @@ public class ContactTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
/* @Test
|
||||||
public void addressBlank() {
|
public void addressBlank() {
|
||||||
testContact.setAddress(" ");
|
testContact.setAddress(" ");
|
||||||
Set<ConstraintViolation<Contact>> constraintViolations = validator.validate(testContact);
|
Set<ConstraintViolation<Contact>> constraintViolations = validator.validate(testContact);
|
||||||
@@ -283,5 +283,5 @@ public class ContactTest {
|
|||||||
"must not be blank",
|
"must not be blank",
|
||||||
constraintViolations.iterator().next().getMessage()
|
constraintViolations.iterator().next().getMessage()
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateTokenGeneratesDifferentTokensForDifferentCreationDates() throws Exception {
|
public void testGenerateTokenGeneratesDifferentTokensForDifferentCreationDates() {
|
||||||
when(clockMock.now())
|
when(clockMock.now())
|
||||||
.thenReturn(DateUtil.yesterday())
|
.thenReturn(DateUtil.yesterday())
|
||||||
.thenReturn(DateUtil.now());
|
.thenReturn(DateUtil.now());
|
||||||
@@ -49,7 +49,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUsernameFromToken() throws Exception {
|
public void getUsernameFromToken() {
|
||||||
when(clockMock.now()).thenReturn(DateUtil.now());
|
when(clockMock.now()).thenReturn(DateUtil.now());
|
||||||
|
|
||||||
final String token = createToken();
|
final String token = createToken();
|
||||||
@@ -58,7 +58,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCreatedDateFromToken() throws Exception {
|
public void getCreatedDateFromToken() {
|
||||||
final Date now = DateUtil.now();
|
final Date now = DateUtil.now();
|
||||||
when(clockMock.now()).thenReturn(now);
|
when(clockMock.now()).thenReturn(now);
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getExpirationDateFromToken() throws Exception {
|
public void getExpirationDateFromToken() {
|
||||||
final Date now = DateUtil.now();
|
final Date now = DateUtil.now();
|
||||||
when(clockMock.now()).thenReturn(now);
|
when(clockMock.now()).thenReturn(now);
|
||||||
final String token = createToken();
|
final String token = createToken();
|
||||||
@@ -78,7 +78,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ExpiredJwtException.class)
|
@Test(expected = ExpiredJwtException.class)
|
||||||
public void expiredTokenCannotBeRefreshed() throws Exception {
|
public void expiredTokenCannotBeRefreshed() {
|
||||||
when(clockMock.now())
|
when(clockMock.now())
|
||||||
.thenReturn(DateUtil.yesterday());
|
.thenReturn(DateUtil.yesterday());
|
||||||
String token = createToken();
|
String token = createToken();
|
||||||
@@ -86,7 +86,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void changedPasswordCannotBeRefreshed() throws Exception {
|
public void changedPasswordCannotBeRefreshed() {
|
||||||
when(clockMock.now())
|
when(clockMock.now())
|
||||||
.thenReturn(DateUtil.now());
|
.thenReturn(DateUtil.now());
|
||||||
String token = createToken();
|
String token = createToken();
|
||||||
@@ -102,7 +102,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canRefreshToken() throws Exception {
|
public void canRefreshToken() {
|
||||||
when(clockMock.now())
|
when(clockMock.now())
|
||||||
.thenReturn(DateUtil.now())
|
.thenReturn(DateUtil.now())
|
||||||
.thenReturn(DateUtil.tomorrow());
|
.thenReturn(DateUtil.tomorrow());
|
||||||
@@ -114,7 +114,7 @@ public class JwtTokenUtilTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canValidateToken() throws Exception {
|
public void canValidateToken() {
|
||||||
when(clockMock.now())
|
when(clockMock.now())
|
||||||
.thenReturn(DateUtil.now());
|
.thenReturn(DateUtil.now());
|
||||||
UserDetails userDetails = mock(JwtUser.class);
|
UserDetails userDetails = mock(JwtUser.class);
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ mv.email.from=mv@felixfoertsch.de
|
|||||||
mv.email.subject-prefix="[MV] "
|
mv.email.subject-prefix="[MV] "
|
||||||
|
|
||||||
mv.signup.expiration=604800
|
mv.signup.expiration=604800
|
||||||
mv.signup.email-subject:Aktivieren Sie Ihren Account
|
mv.signup.email-subject=Aktivieren Sie Ihren Account
|
||||||
Reference in New Issue
Block a user