pax_global_header 0000666 0000000 0000000 00000000064 13560032360 0014510 g ustar 00root root 0000000 0000000 52 comment=f29db93fdb724bb7d25c11cdd211dc86a63b3349
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/ 0000775 0000000 0000000 00000000000 13560032360 0020102 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/.gitignore 0000664 0000000 0000000 00000001300 13560032360 0022064 0 ustar 00root root 0000000 0000000 .DS_Store
node_modules
gms-ui/dist
gms-ui/node/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
HELP.md
gms/target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
nbactions.xml
### VS Code ###
.vscode/
/gms-ui/target/
/gms/nbactions-release-profile.xml
/gms-client/gms-client-lib/target/
/gms-client/gms-cli/target/
/gms/node/
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/README.md 0000664 0000000 0000000 00000002547 13560032360 0021371 0 ustar 00root root 0000000 0000000 # IA2 GMS
## Database Docker image
To build the image run **from current directory**:
docker build -f database/Dockerfile --tag gms-db .
To start the image and use the database:
docker run -d -p 5432:5432 -i -t gms-db:latest
## GMS Docker image
To build the image:
mvn clean package dockerfile:build -DskipTests
To run:
docker run --env-file docker-env -d -p 8081:8081 -i -t gms:latest
## Developer notes
Backend and frontend are 2 separate applications:
* the backend is the Maven application in the gms folder, based on Java and Spring Boot;
* the frontend is the npm application is the gms-ui folder, based on Vue.js.
The Maven application automatically packs the Vue.js products inside the final jar, however the frontend application can be tested isolatedly running `npm run serve` in order to take advantage of the npm autoreload functionalities.
By default http calls are mocked inside the Vue.js application.
In order to rely on real server calls edit the .env.development file in this way:
VUE_APP_API_CLIENT = 'server'
VUE_APP_API_BASE_URL = 'http://localhost:8081/gms/'
This assumes that your backend runs on 8081 port (with dev profile active, in order to enable the CORS policy) and the frontend runs on 8080 port.
First, do the login using the application running on the 8081 port, then you can access the frontend on the 8080.
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/database/ 0000775 0000000 0000000 00000000000 13560032360 0021646 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/database/Dockerfile 0000664 0000000 0000000 00000000223 13560032360 0023635 0 ustar 00root root 0000000 0000000 FROM library/postgres:11
COPY gms/src/main/resources/sql/init.sql /docker-entrypoint-initdb.d/
COPY database/user.sql /docker-entrypoint-initdb.d/
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/database/user.sql 0000664 0000000 0000000 00000000312 13560032360 0023341 0 ustar 00root root 0000000 0000000 CREATE ROLE gms WITH LOGIN PASSWORD 'gms';
GRANT USAGE ON SCHEMA public TO gms;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO gms;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO gms; ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/docker-env 0000664 0000000 0000000 00000000766 13560032360 0022073 0 ustar 00root root 0000000 0000000 SPRING_DATASOURCE_URL=jdbc:postgresql://140.105.79.115:5432/postgres
SECURITY_OAUTH2_CLIENT_ACCESS-TOKEN-URI=http://140.105.79.115/rap-ia2/auth/oauth2/token
SECURITY_OAUTH2_CLIENT_USER-AUTHORIZATION-URI=http://localhost/rap-ia2/auth/oauth2/authorize
SECURITY_OAUTH2_RESOURCE_TOKEN-INFO-URI=http://140.105.79.115/rap-ia2/auth/oauth2/check_token
SECURITY_OAUTH2_RESOURCE_JWK_KEY-SET-URI=http://140.105.79.115/rap-ia2/auth/oidc/jwks
RAP_WS-URL=http://140.105.79.115/rap-ia2/ws
SPRING_PROFILES_ACTIVE=prod
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/ 0000775 0000000 0000000 00000000000 13560032360 0022144 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/ 0000775 0000000 0000000 00000000000 13560032360 0023477 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/.gitignore 0000664 0000000 0000000 00000000515 13560032360 0025470 0 ustar 00root root 0000000 0000000 HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/gms.properties 0000664 0000000 0000000 00000000105 13560032360 0026377 0 ustar 00root root 0000000 0000000 base_url=http://localhost:8081/gms
client_id=test
client_secret=test
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/pom.xml 0000664 0000000 0000000 00000003131 13560032360 0025012 0 ustar 00root root 0000000 0000000
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.7.RELEASE
it.inaf.ia2
gms-cli
0.0.1-SNAPSHOT
gms-cli
GMS Command Line Client
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
${project.groupId}
gms-client-lib
1.0-SNAPSHOT
org.springframework.boot
spring-boot-maven-plugin
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/ 0000775 0000000 0000000 00000000000 13560032360 0024266 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/ 0000775 0000000 0000000 00000000000 13560032360 0025212 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/ 0000775 0000000 0000000 00000000000 13560032360 0026133 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/ 0000775 0000000 0000000 00000000000 13560032360 0026547 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ 0000775 0000000 0000000 00000000000 13560032360 0027464 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ia2/ 0000775 0000000 0000000 00000000000 13560032360 0030137 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/ 0000775 0000000 0000000 00000000000 13560032360 0030725 5 ustar 00root root 0000000 0000000 cli/ 0000775 0000000 0000000 00000000000 13560032360 0031415 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms CLI.java 0000664 0000000 0000000 00000011006 13560032360 0032665 0 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import it.inaf.ia2.gms.client.GmsClient;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class CLI implements CommandLineRunner {
private final GmsClient client;
public CLI() throws IOException {
File config = new File("gms.properties");
if (!config.exists()) {
System.err.println("Unable to find the file gms.properties");
System.exit(1);
}
Properties properties = new Properties();
try (InputStream in = new FileInputStream(config)) {
properties.load(in);
}
String baseUrl = (String) properties.get("base_url");
if (baseUrl == null) {
System.err.println("Missing base_url in gms.properties");
System.exit(1);
}
String clientId = (String) properties.get("client_id");
if (clientId == null) {
System.err.println("Missing client_id in gms.properties");
System.exit(1);
}
String clientSecret = (String) properties.get("client_secret");
if (clientSecret == null) {
System.err.println("Missing client_secret in gms.properties");
System.exit(1);
}
client = new GmsClient(baseUrl, clientId, clientSecret);
}
@Override
public void run(String... args) throws Exception {
if (args.length < 2) {
displayUsage();
}
switch (args[0]) {
case "create-group":
client.addGroup(getNames(args, 1));
System.out.println("Group created");
break;
case "delete-group":
client.removeGroup(getNames(args, 1));
System.out.println("Group deleted");
break;
case "add-member":
if (args.length < 3) {
displayUsage();
}
client.addMember(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Member added");
break;
case "remove-member":
if (args.length < 3) {
displayUsage();
}
client.removeMember(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Member removed");
break;
case "add-permission":
if (args.length < 4) {
displayUsage();
}
client.addPermission(getNames(args, 1, args.length - 3), args[args.length - 2], args[args.length - 1]);
System.out.println("Permission added");
break;
case "delete-permission":
if (args.length < 4) {
displayUsage();
}
client.removePermission(getNames(args, 1, args.length - 2), args[args.length - 1]);
System.out.println("Permission removed");
break;
case "prepare-join":
if (args.length != 3) {
displayUsage();
}
client.prepareToJoin(args[1], args[2]);
System.out.println("Join prepared");
break;
default:
displayUsage();
break;
}
}
private void displayUsage() {
System.out.println("java -jar gms-client.jar\n"
+ " create-group \n"
+ " delete-group \n"
+ " add-member \n"
+ " remove-member \n"
+ " add-permission \n"
+ " delete-permission \n"
+ " prepare-join ");
System.exit(0);
}
private List getNames(String[] args, int startIndex) {
return getNames(args, startIndex, args.length - 1);
}
private List getNames(String[] args, int startIndex, int endIndex) {
List names = new ArrayList<>();
for (int i = startIndex; i <= endIndex; i++) {
names.add(args[i]);
}
return names;
}
}
GmsCliApplication.java 0000664 0000000 0000000 00000000470 13560032360 0035623 0 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GmsCliApplication {
public static void main(String[] args) {
SpringApplication.run(GmsCliApplication.class, args);
}
}
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/resources/ 0000775 0000000 0000000 00000000000 13560032360 0027224 5 ustar 00root root 0000000 0000000 application.properties 0000664 0000000 0000000 00000000062 13560032360 0033564 0 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/main/resources spring.main.banner-mode=off
logging.level.root=OFF ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/ 0000775 0000000 0000000 00000000000 13560032360 0025245 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/ 0000775 0000000 0000000 00000000000 13560032360 0026166 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/ 0000775 0000000 0000000 00000000000 13560032360 0026602 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/inaf/ 0000775 0000000 0000000 00000000000 13560032360 0027517 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/inaf/ia2/ 0000775 0000000 0000000 00000000000 13560032360 0030172 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms/ 0000775 0000000 0000000 00000000000 13560032360 0030760 5 ustar 00root root 0000000 0000000 cli/ 0000775 0000000 0000000 00000000000 13560032360 0031450 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms GmsCliApplicationTests.java 0000664 0000000 0000000 00000000520 13560032360 0036675 0 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-cli/src/test/java/it/inaf/ia2/gms/cli package it.inaf.ia2.gms.cli;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GmsCliApplicationTests {
@Test
public void contextLoads() {
}
}
ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-client-lib/ 0000775 0000000 0000000 00000000000 13560032360 0024752 5 ustar 00root root 0000000 0000000 ia2-gms-f29db93fdb724bb7d25c11cdd211dc86a63b3349/gms-client/gms-client-lib/pom.xml 0000664 0000000 0000000 00000003005 13560032360 0026265 0 ustar 00root root 0000000 0000000
4.0.0
it.inaf.ia2
gms-client-lib
1.0-SNAPSHOT
jar
UTF-8
1.8
1.8
5.1.8.RELEASE
org.springframework
spring-web
${spring.version}
com.fasterxml.jackson.core
jackson-databind
2.9.9
junit
junit
4.12
test
org.mockito
mockito-core
2.23.4
test