Skip to content

Commit 67d7c98

Browse files
Merge pull request #50 from aquality-automation/develop
Develop
2 parents ca5edc6 + 5cde323 commit 67d7c98

File tree

70 files changed

+1395
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1395
-555
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 0.3.6 (2020-02-24)
4+
5+
Features:
6+
- Test Run view: Add stability indicator -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/60)
7+
- Provide public API -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/56)
8+
39
## 0.3.5 (2020-02-15)
410

511
Features:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<groupId>unifi_reporting_api</groupId>
77
<artifactId>api</artifactId>
88
<packaging>war</packaging>
9-
<version>0.3.5</version>
9+
<version>0.3.6</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/main/controllers/Administration/AppSettingsController.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,46 @@ public AppSettingsController(UserDto user) {
2626
}
2727

2828
public LdapDto getLdap() throws AqualityException {
29-
if(baseUser.isAdmin()){
29+
if (baseUser.isAdmin()) {
3030
return ldapDao.getAll().get(0);
31-
}else{
31+
} else {
3232
throw new AqualityPermissionsException("Account is not allowed to view LDAP Settings", baseUser);
3333
}
3434
}
35+
3536
public AppSettingsDto getApp() throws AqualityException {
3637
return appSettingsDao.getAll().get(0);
3738
}
3839

3940
public LdapDto create(LdapDto template) throws AqualityException {
40-
if(baseUser.isAdmin()){
41+
if (baseUser.isAdmin()) {
4142
template.setAdminSecret(template.getAdminSecret() == null || template.getAdminSecret().equals("")
4243
? ""
4344
: hideAdminSecret(template.getAdminSecret()));
4445
return ldapDao.create(template);
45-
}else{
46+
} else {
4647
throw new AqualityPermissionsException("Account is not allowed to update LDAP Settings", baseUser);
4748
}
4849
}
4950

5051

5152
@Override
5253
public AppSettingsDto create(AppSettingsDto template) throws AqualityException {
53-
if(baseUser.isAdmin()){
54+
if (baseUser.isAdmin()) {
5455
return appSettingsDao.create(template);
55-
}else{
56+
} else {
5657
throw new AqualityPermissionsException("Account is not allowed to update Application Settings", baseUser);
5758
}
5859
}
5960

60-
@Override @NotImplemented
61+
@Override
62+
@NotImplemented
6163
public List<AppSettingsDto> get(AppSettingsDto entity) throws AqualityException {
6264
throw new UnsupportedOperationException();
6365
}
6466

65-
@Override @NotImplemented
67+
@Override
68+
@NotImplemented
6669
public boolean delete(AppSettingsDto entity) throws AqualityException {
6770
throw new UnsupportedOperationException();
6871
}
@@ -79,11 +82,11 @@ public String getAdminSecret() throws AqualityException {
7982
}
8083

8184
private String hideAdminSecret(String secret) throws AqualityException {
82-
try{
85+
try {
8386
Base64 base64 = new Base64();
84-
secret = base64.encodeToString(("JmbGFzYmRmamtiYXNsZA"+secret+"qYXNkaGxma2poYXNka2xqZmJka2").getBytes("utf-8"));
85-
return base64.encodeToString(("YXNkamhmbGtqYXNkaGx"+secret+"a2poYXNka2xqZmJka2phc2JmbGFzYmRmamtiYXNsZA").getBytes("utf-8"));
86-
}catch (UnsupportedEncodingException e){
87+
secret = base64.encodeToString(("JmbGFzYmRmamtiYXNsZA" + secret + "qYXNkaGxma2poYXNka2xqZmJka2").getBytes("utf-8"));
88+
return base64.encodeToString(("YXNkamhmbGtqYXNkaGx" + secret + "a2poYXNka2xqZmJka2phc2JmbGFzYmRmamtiYXNsZA").getBytes("utf-8"));
89+
} catch (UnsupportedEncodingException e) {
8790
throw new AqualityException("Cannot hide Admin Secret.");
8891
}
8992
}

src/main/java/main/controllers/Administration/EmailSettingsController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public EmailSettingsDto create(EmailSettingsDto template) throws AqualityExcepti
2929
return emailSettingsDao.create(template);
3030
}
3131

32-
@Override @NotImplemented
32+
@Override
33+
@NotImplemented
3334
public boolean delete(EmailSettingsDto entity) throws AqualityException {
3435
throw new UnsupportedOperationException();
3536
}

src/main/java/main/controllers/Administration/UserController.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public UserController(UserDto user) {
3838

3939
@Override
4040
public UserDto create(UserDto template) throws AqualityException {
41-
if(baseUser.isAdmin() || baseUser.getId().equals(template.getId())){
42-
if(template.getPassword() != null){
41+
if (baseUser.isAdmin() || baseUser.getId().equals(template.getId())) {
42+
if (template.getPassword() != null) {
4343
template.setPassword(saltPassword(template, template.getPassword()));
4444
}
4545
return userDao.create(template);
46-
}else{
46+
} else {
4747
throw new AqualityPermissionsException("Account is not allowed to create User", baseUser);
4848
}
4949
}
@@ -55,9 +55,9 @@ public List<UserDto> get(UserDto template) throws AqualityException {
5555

5656
@Override
5757
public boolean delete(UserDto template) throws AqualityException {
58-
if(baseUser.isAdmin()){
58+
if (baseUser.isAdmin()) {
5959
return userDao.delete(template);
60-
}else{
60+
} else {
6161
throw new AqualityPermissionsException("Account is not allowed to delete User", baseUser);
6262
}
6363
}
@@ -77,7 +77,7 @@ public UserDto updatePassword(PasswordDto password) throws AqualityException {
7777
}
7878

7979
UserDto auth(String authString, boolean ldap) throws AqualityException {
80-
Base64 base64= new Base64();
80+
Base64 base64 = new Base64();
8181
String authStringDecoded = StringUtils.newStringUtf8(base64.decode(authString));
8282
String[] authStringSplit = authStringDecoded.split(":");
8383
ConnectionUrlParser.Pair<String, PrivateKey> privateKeyPair
@@ -94,7 +94,7 @@ UserDto auth(String authString, boolean ldap) throws AqualityException {
9494

9595
UserDto user = ldap ? handleLDAPAuthorization(authStringSplit[0], password) : checkUser(authStringSplit[0], password);
9696

97-
if(user != null){
97+
if (user != null) {
9898
user.setSession_code(generateSessionCode(user));
9999
updateSession(user);
100100
return user;
@@ -113,7 +113,7 @@ private List<UserDto> toPublicUsers(List<UserDto> users) {
113113
}
114114

115115
private String generateSessionCode(UserDto user) {
116-
Base64 base64= new Base64();
116+
Base64 base64 = new Base64();
117117
DateUtils dates = new DateUtils();
118118
String encode = null;
119119
try {
@@ -124,21 +124,21 @@ private String generateSessionCode(UserDto user) {
124124
return encode;
125125
}
126126

127-
private String saltPassword(UserDto user, String password){
127+
private String saltPassword(UserDto user, String password) {
128128
String passHash = DigestUtils.md5Hex(password);
129-
return DigestUtils.md5Hex(user.getEmail()+passHash+"kjr1fdd00das");
129+
return DigestUtils.md5Hex(user.getEmail() + passHash + "kjr1fdd00das");
130130
}
131131

132132
private UserDto checkUser(String user_name, String password) throws AqualityException {
133133
UserDto user = new UserDto();
134134
user.setUser_name(user_name);
135135
List<UserDto> users = userDao.searchAll(user);
136136

137-
if(users.size() > 0){
137+
if (users.size() > 0) {
138138
user = users.get(0);
139139
String correctHex = user.getPassword();
140140
String actualHex = saltPassword(user, password);
141-
if(correctHex.equals(actualHex)){
141+
if (correctHex.equals(actualHex)) {
142142
return user;
143143
}
144144
}
@@ -150,12 +150,12 @@ private UserDto handleLDAPAuthorization(String userName, String password) throws
150150
LDAPAuthenticator ldap = new LDAPAuthenticator();
151151
UserDto user;
152152
user = ldap.tryAuthWithLdap(userName, password);
153-
if(user != null){
153+
if (user != null) {
154154
UserDto templateUser = new UserDto();
155155
templateUser.setUser_name(user.getUser_name());
156156
List<UserDto> users = get(templateUser);
157157

158-
if(users.size() > 0){
158+
if (users.size() > 0) {
159159
user.setId(users.get(0).getId());
160160
}
161161

0 commit comments

Comments
 (0)