13
13
import java .util .Objects ;
14
14
15
15
public class APITokenController extends BaseController <APITokenDto > {
16
- private APITokenDao importTokenDao ;
16
+ private APITokenDao apiTokenDao ;
17
17
public APITokenController (UserDto user ) {
18
18
super (user );
19
- importTokenDao = new APITokenDao ();
19
+ apiTokenDao = new APITokenDao ();
20
20
}
21
21
22
22
@ Override
@@ -27,7 +27,7 @@ public List<APITokenDto> get(APITokenDto entity) throws AqualityException {
27
27
@ Override
28
28
public APITokenDto create (APITokenDto template ) throws AqualityException {
29
29
if (baseUser .isAdmin () || baseUser .isManager () || baseUser .getProjectUser (template .getId ()).isManager () || baseUser .getProjectUser (template .getId ()).isAdmin ()){
30
- return importTokenDao .create (template );
30
+ return apiTokenDao .create (template );
31
31
}else {
32
32
throw new AqualityPermissionsException ("Account is not allowed to create API Token" , baseUser );
33
33
}
@@ -42,10 +42,10 @@ public boolean isTokenValid(String token, Integer projectId) throws AqualityExce
42
42
String actualHash = DigestUtils .md5Hex (token + "advbc1671-nlksdui-ff" );
43
43
APITokenDto tokenDTO = new APITokenDto ();
44
44
tokenDTO .setId (projectId );
45
- List <APITokenDto > importTokens = importTokenDao .searchAll (tokenDTO );
45
+ List <APITokenDto > apiTokens = apiTokenDao .searchAll (tokenDTO );
46
46
47
- if (importTokens .size () > 0 ){
48
- String expectedHash = (importTokens .get (0 )).getApi_token ();
47
+ if (apiTokens .size () > 0 ){
48
+ String expectedHash = (apiTokens .get (0 )).getApi_token ();
49
49
return Objects .equals (actualHash , expectedHash );
50
50
}
51
51
0 commit comments