[DEV] update New models done

This commit is contained in:
Edouard DUPIN 2023-11-27 22:29:16 +01:00
parent a78c3f5c1f
commit 4a8dfe3fb0
4 changed files with 27 additions and 23 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kar</groupId>
<artifactId>karso</artifactId>
<version>0.4.3</version>
<version>0.5.0</version>
<properties>
<maven.compiler.version>3.1</maven.compiler.version>
<maven.compiler.source>17</maven.compiler.source>
@ -20,12 +20,12 @@
<dependency>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.4.0</version>
<version>0.5.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<version>2.0.9</version>
</dependency>
<!--
************************************************************
@ -35,13 +35,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -46,7 +46,7 @@ public class ApplicationResource {
final List<Long> out = new ArrayList<>();
List<UserLinkApplication> links = null;
try {
links = DataAccess.getsWhere(UserLinkApplication.class, new QueryCondition("user_id", "=", userId));
links = DataAccess.getsWhere(UserLinkApplication.class, new QueryCondition("userId", "=", userId));
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -55,18 +55,17 @@ public class ApplicationResource {
return out;
}
for (final UserLinkApplication app : links) {
out.add(app.application_id);
out.add(app.applicationId);
}
return out;
}
public List<Long> getListOfUsers(final Long applicationId) {
final List<Long> out = new ArrayList<>();
List<UserLinkApplication> links = null;
try {
links = DataAccess.getsWhere(UserLinkApplication.class, new QueryCondition("application_id", "=", applicationId));
links = DataAccess.getsWhere(UserLinkApplication.class, new QueryCondition("object2id", "=", applicationId));
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
final String result = "SERVER Internal error";
this.logger.error(" result: {}", result);
@ -74,13 +73,13 @@ public class ApplicationResource {
}
this.logger.debug("Find list of user for an application: {}", links);
for (final UserLinkApplication app : links) {
out.add(app.user_id);
out.add(app.userId);
}
return out;
}
////////////////////////////////////////////////////////////////////////////////////////
//
// Generic /application/
// Generic /application/
//
////////////////////////////////////////////////////////////////////////////////////////
@ -124,7 +123,7 @@ public class ApplicationResource {
////////////////////////////////////////////////////////////////////////////////////////
//
// Generic /application/{id}
// Generic /application/{id}
//
////////////////////////////////////////////////////////////////////////////////////////
@ -154,7 +153,7 @@ public class ApplicationResource {
////////////////////////////////////////////////////////////////////////////////////////
//
// Generic /{id}/*
// Generic /{id}/*
//
////////////////////////////////////////////////////////////////////////////////////////
@ -170,7 +169,7 @@ public class ApplicationResource {
////////////////////////////////////////////////////////////////////////////////////////
//
// Generic /application/*
// Generic /application/*
//
////////////////////////////////////////////////////////////////////////////////////////
@ -263,7 +262,7 @@ public class ApplicationResource {
UserLinkApplication links = null;
try {
links = DataAccess.getWhere(UserLinkApplication.class,
new QueryAnd(new QueryCondition("user_id", "=", gc.userByToken.id), new QueryCondition("deleted", "=", 0), new QueryCondition("application_id", "=", appl.id)));
new QueryAnd(new QueryCondition("userId", "=", gc.userByToken.id), new QueryCondition("deleted", "=", 0), new QueryCondition("object2id", "=", appl.id)));
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -283,10 +282,12 @@ public class ApplicationResource {
applicationRight.put("USER", true);
}
final Map<String, Object> outRight = new HashMap<>();
// we set the right in the under map to manage multiple application group right. and in some application user can see other user or all user of the application
// we set the right in the under map to manage multiple application group right.
// and in some application user can see other user or all user of the
// application
outRight.put(applicationName, applicationRight);
final String ret = JWTWrapper.generateJWToken(gc.userByToken.id, gc.userByToken.name, "KarAuth", applicationName, outRight, -appl.ttl);
//logger.debug(" ==> generate token: {}", ret);
// logger.debug(" ==> generate token: {}", ret);
String returnAdress = appl.redirect;
if (isDev) {
returnAdress = appl.redirectDev;

View File

@ -15,6 +15,7 @@ import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.persistence.Column;
import jakarta.persistence.Table;
// TODO: remove this, it must be generated instead of manually create ///
@ -22,6 +23,8 @@ import jakarta.persistence.Table;
@DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserLinkApplication extends GenericDataSoftDelete {
public Long user_id;
public Long application_id;
@Column(name = "object1id")
public Long userId;
@Column(name = "object2id")
public Long applicationId;
}

View File

@ -1,13 +1,13 @@
{
"name": "karideo",
"name": "karso",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "karideo",
"name": "karso",
"version": "0.0.0",
"license": "MIT",
"license": "MPL-2",
"dependencies": {
"@angular/animations": "^14.2.10",
"@angular/cdk": "^14.2.7",