Commit a66267cb authored by Spiros Koulouzis's avatar Spiros Koulouzis

Added permissions

parent 4927b5ba
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.auth;
import nl.uva.sne.drip.commons.v1.types.OwnedObject;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.stereotype.Component;
/**
*
* @author S. Koulouzis
*/
@Component("PermissionChecker")
public class PermissionChecker {
public boolean canRead(OwnedObject obj, User user) {
return false;
}
public boolean isOwner(OwnedObject obj, User user) {
String ownerid = obj.getOwner();
return user.getId().equals(ownerid);
}
}
...@@ -36,7 +36,8 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi ...@@ -36,7 +36,8 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
*/ */
@Configuration @Configuration
@EnableWebSecurity @EnableWebSecurity
@EnableGlobalMethodSecurity(jsr250Enabled = true) //@EnableGlobalMethodSecurity(jsr250Enabled = true, prePostEnabled = true)
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter { public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
......
...@@ -24,4 +24,15 @@ import org.springframework.data.mongodb.repository.MongoRepository; ...@@ -24,4 +24,15 @@ import org.springframework.data.mongodb.repository.MongoRepository;
*/ */
public interface CloudCredentialsDao extends MongoRepository<CloudCredentials, String> { public interface CloudCredentialsDao extends MongoRepository<CloudCredentials, String> {
@Override
CloudCredentials findOne(String id);
//
// @PreAuthorize(ALLOWED_FOR_ADMINISTRATOR)
// @Override
// void delete(String id);
//
// @PreAuthorize(ALLOWED_FOR_OWNER + " or " + ALLOWED_FOR_ADMINISTRATOR)
// @Override
// List<CloudCredentials> findAll();
} }
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
*/ */
package nl.uva.sne.drip.api.dao; package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.v1.types.UserScript; import nl.uva.sne.drip.commons.v1.types.Script;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
/** /**
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
public interface UserScriptDao extends MongoRepository<UserScript, String> { public interface UserScriptDao extends MongoRepository<Script, String> {
} }
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
*
* @author S. Koulouzis
*/
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class UnauthorizedExeption extends RuntimeException {
public UnauthorizedExeption(String string) {
super(string);
}
public UnauthorizedExeption() {
super();
}
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import nl.uva.sne.drip.api.dao.CloudCredentialsDao;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.Permissions;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreFilter;
import org.springframework.stereotype.Service;
/**
*
* @author S. Koulouzis
*/
@Service
public class CloudCredentialsService {
@Autowired
private CloudCredentialsDao dao;
@PreFilter("(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public CloudCredentials save(CloudCredentials cloudCredentials) {
Permissions permissions = new Permissions();
// String owner = user.getUsername();
// cloudCredentials.setOwner(owner);
System.err.println(cloudCredentials.getOwner());
Set<String> read = new HashSet<>();
permissions.setRead(read);
Set<String> write = new HashSet<>();
permissions.setWrite(write);
cloudCredentials.setPermissions(permissions);
return dao.save(cloudCredentials);
}
@PreAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public CloudCredentials findOne(String id) {
CloudCredentials creds = dao.findOne(id);
return creds;
}
public void delete(String id) {
dao.delete(id);
}
@PreAuthorize(" (hasRole('ROLE_ADMIN')) or (hasRole('ROLE_USER'))")
@PostFilter("(filterObject.owner == authentication.name)")
public List<CloudCredentials> findAll() {
return dao.findAll();
}
}
...@@ -107,7 +107,7 @@ public class PlannerService { ...@@ -107,7 +107,7 @@ public class PlannerService {
if (t2 == null) { if (t2 == null) {
throw new BadRequestException(); throw new BadRequestException();
} }
Map<String, Object> map = t2.getKvMap(); Map<String, Object> map = t2.getKeyValue();
String json = Converter.map2JsonString(map); String json = Converter.map2JsonString(map);
json = json.replaceAll("\\uff0E", "\\."); json = json.replaceAll("\\uff0E", "\\.");
byte[] bytes = json.getBytes(); byte[] bytes = json.getBytes();
...@@ -132,10 +132,10 @@ public class PlannerService { ...@@ -132,10 +132,10 @@ public class PlannerService {
throw new NotFoundException(); throw new NotFoundException();
} }
Map<String, Object> map = plan.getKvMap(); Map<String, Object> map = plan.getKeyValue();
Set<String> ids = plan.getLoweLevelPlanIDs(); Set<String> ids = plan.getLoweLevelPlanIDs();
for (String lowID : ids) { for (String lowID : ids) {
Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKvMap(); Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKeyValue();
map.putAll(lowLevelMap); map.putAll(lowLevelMap);
} }
......
...@@ -101,7 +101,7 @@ public class SimplePlannerService { ...@@ -101,7 +101,7 @@ public class SimplePlannerService {
if (t2 == null) { if (t2 == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
Map<String, Object> map = t2.getKvMap(); Map<String, Object> map = t2.getKeyValue();
String ymlStr = Converter.map2YmlString(map); String ymlStr = Converter.map2YmlString(map);
ymlStr = ymlStr.replaceAll("\\uff0E", "\\."); ymlStr = ymlStr.replaceAll("\\uff0E", "\\.");
byte[] bytes = ymlStr.getBytes(); byte[] bytes = ymlStr.getBytes();
...@@ -134,10 +134,10 @@ public class SimplePlannerService { ...@@ -134,10 +134,10 @@ public class SimplePlannerService {
throw new NotFoundException(); throw new NotFoundException();
} }
Map<String, Object> map = plan.getKvMap(); Map<String, Object> map = plan.getKeyValue();
Set<String> ids = plan.getLoweLevelPlanIDs(); Set<String> ids = plan.getLoweLevelPlanIDs();
for (String lowID : ids) { for (String lowID : ids) {
Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKvMap(); Map<String, Object> lowLevelMap = planDao.findOne(lowID).getKeyValue();
map.putAll(lowLevelMap); map.putAll(lowLevelMap);
} }
......
...@@ -43,7 +43,7 @@ public class ToscaService { ...@@ -43,7 +43,7 @@ public class ToscaService {
throw new NotFoundException(); throw new NotFoundException();
} }
Map<String, Object> map = tosca.getKvMap(); Map<String, Object> map = tosca.getKeyValue();
if (fromat != null && fromat.equals("yml")) { if (fromat != null && fromat.equals("yml")) {
String ymlStr = Converter.map2YmlString(map); String ymlStr = Converter.map2YmlString(map);
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
*/ */
package nl.uva.sne.drip.api.service; package nl.uva.sne.drip.api.service;
import java.util.Collection;
import java.util.HashSet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import nl.uva.sne.drip.api.dao.UserDao; import nl.uva.sne.drip.api.dao.UserDao;
...@@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -39,7 +36,7 @@ public class UserService implements UserDetailsService { ...@@ -39,7 +36,7 @@ public class UserService implements UserDetailsService {
public static final String USER = "USER"; public static final String USER = "USER";
@Autowired @Autowired
UserDao dao; private UserDao dao;
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
......
...@@ -77,7 +77,8 @@ public class CloudConfigurationController0 { ...@@ -77,7 +77,8 @@ public class CloudConfigurationController0 {
} }
cloudCredentials.setLogineKeys(loginKeys); cloudCredentials.setLogineKeys(loginKeys);
cloudCredentials.setCloudProviderName("ec2"); cloudCredentials.setCloudProviderName("ec2");
cloudCredentialsDao.save(cloudCredentials);
cloudCredentials = cloudCredentialsDao.save(cloudCredentials);
return "Success: " + cloudCredentials.getId(); return "Success: " + cloudCredentials.getId();
} }
......
...@@ -82,7 +82,7 @@ public class PlannerController0 { ...@@ -82,7 +82,7 @@ public class PlannerController0 {
} }
e.name = p1Name; e.name = p1Name;
e.content = Converter.map2YmlString(plan1.getKvMap()).replaceAll("\n", "\\n"); e.content = Converter.map2YmlString(plan1.getKeyValue()).replaceAll("\n", "\\n");
files.add(e); files.add(e);
for (String lowiID : plan1.getLoweLevelPlanIDs()) { for (String lowiID : plan1.getLoweLevelPlanIDs()) {
...@@ -97,7 +97,7 @@ public class PlannerController0 { ...@@ -97,7 +97,7 @@ public class PlannerController0 {
} }
e.name = p1Name; e.name = p1Name;
e.content = Converter.map2YmlString(lowPlan1.getKvMap()).replaceAll("\n", "\\n");; e.content = Converter.map2YmlString(lowPlan1.getKeyValue()).replaceAll("\n", "\\n");;
files.add(e); files.add(e);
} }
......
...@@ -32,14 +32,16 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -32,14 +32,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.dao.CloudCredentialsDao;
import nl.uva.sne.drip.api.exception.BadRequestException; import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.NotFoundException; import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.exception.NullKeyException; import nl.uva.sne.drip.api.exception.NullKeyException;
import nl.uva.sne.drip.api.exception.NullKeyIDException; import nl.uva.sne.drip.api.exception.NullKeyIDException;
import nl.uva.sne.drip.api.service.CloudCredentialsService;
import nl.uva.sne.drip.api.service.UserService; import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v1.types.LoginKey; import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.User;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -54,12 +56,12 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -54,12 +56,12 @@ import org.springframework.web.multipart.MultipartFile;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@RestController @RestController
@RequestMapping("/user/v1.0/configuration/cloud") @RequestMapping("/user/v1.0/credentials/cloud")
@Component @Component
public class CloudConfigurationController { public class CloudCredentialsController {
@Autowired @Autowired
private CloudCredentialsDao cloudCredentialsDao; private CloudCredentialsService cloudCredentialsService;
/** /**
* Post the cloud credentials. * Post the cloud credentials.
...@@ -80,7 +82,8 @@ public class CloudConfigurationController { ...@@ -80,7 +82,8 @@ public class CloudConfigurationController {
if (cloudCredentials.getKeyIdAlias() == null) { if (cloudCredentials.getKeyIdAlias() == null) {
throw new NullKeyIDException(); throw new NullKeyIDException();
} }
cloudCredentialsDao.save(cloudCredentials); // User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
cloudCredentials = cloudCredentialsService.save(cloudCredentials);
return cloudCredentials.getId(); return cloudCredentials.getId();
} }
...@@ -97,8 +100,9 @@ public class CloudConfigurationController { ...@@ -97,8 +100,9 @@ public class CloudConfigurationController {
public @ResponseBody public @ResponseBody
String addLogineKey(@RequestParam("file") MultipartFile file, @PathVariable("id") String id) { String addLogineKey(@RequestParam("file") MultipartFile file, @PathVariable("id") String id) {
try { try {
CloudCredentials cc = cloudCredentialsDao.findOne(id);
if (cc == null) { CloudCredentials cloudCredentials = cloudCredentialsService.findOne(id);
if (cloudCredentials == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
if (file.isEmpty()) { if (file.isEmpty()) {
...@@ -106,23 +110,24 @@ public class CloudConfigurationController { ...@@ -106,23 +110,24 @@ public class CloudConfigurationController {
} }
String originalFileName = file.getOriginalFilename(); String originalFileName = file.getOriginalFilename();
byte[] bytes = file.getBytes(); byte[] bytes = file.getBytes();
List<LoginKey> logInKeys = cc.getLoginKeys(); List<LoginKey> logInKeys = cloudCredentials.getLoginKeys();
if (logInKeys == null) { if (logInKeys == null) {
logInKeys = new ArrayList<>(); logInKeys = new ArrayList<>();
} }
LoginKey key = new LoginKey(); LoginKey key = new LoginKey();
key.setKey(new String(bytes, "UTF-8")); key.setKey(new String(bytes, "UTF-8"));
if (cc.getCloudProviderName().toLowerCase().equals("ec2")) { if (cloudCredentials.getCloudProviderName().toLowerCase().equals("ec2")) {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName)); attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName));
key.setAttributes(attributes); key.setAttributes(attributes);
} }
logInKeys.add(key); logInKeys.add(key);
cc.setLogineKeys(logInKeys); cloudCredentials.setLogineKeys(logInKeys);
cloudCredentialsDao.save(cc); // User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return cloudCredentialsDao.findOne(id).getId(); cloudCredentials = cloudCredentialsService.save(cloudCredentials);
return cloudCredentials.getId();
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger(CloudConfigurationController.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(CloudCredentialsController.class.getName()).log(Level.SEVERE, null, ex);
} }
return null; return null;
} }
...@@ -137,7 +142,8 @@ public class CloudConfigurationController { ...@@ -137,7 +142,8 @@ public class CloudConfigurationController {
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody public @ResponseBody
CloudCredentials get(@PathVariable("id") String id) { CloudCredentials get(@PathVariable("id") String id) {
CloudCredentials cc = cloudCredentialsDao.findOne(id); // User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
CloudCredentials cc = cloudCredentialsService.findOne(id);
if (cc == null) { if (cc == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
...@@ -154,7 +160,7 @@ public class CloudConfigurationController { ...@@ -154,7 +160,7 @@ public class CloudConfigurationController {
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody public @ResponseBody
String delete(@PathVariable("id") String id) { String delete(@PathVariable("id") String id) {
cloudCredentialsDao.delete(id); cloudCredentialsService.delete(id);
return "Deleted :" + id; return "Deleted :" + id;
} }
...@@ -167,7 +173,7 @@ public class CloudConfigurationController { ...@@ -167,7 +173,7 @@ public class CloudConfigurationController {
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody public @ResponseBody
List<String> getIds() { List<String> getIds() {
List<CloudCredentials> all = cloudCredentialsDao.findAll(); List<CloudCredentials> all = cloudCredentialsService.findAll();
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (CloudCredentials tr : all) { for (CloudCredentials tr : all) {
ids.add(tr.getId()); ids.add(tr.getId());
......
...@@ -49,6 +49,7 @@ import nl.uva.sne.drip.commons.v1.types.ClusterCredentials; ...@@ -49,6 +49,7 @@ import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter; import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.LoginKey; import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo; import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -59,7 +60,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -59,7 +60,7 @@ import org.springframework.web.bind.annotation.RequestParam;
*/ */
@RestController @RestController
@RequestMapping("/user/v1.0/deployer") @RequestMapping("/user/v1.0/deployer")
@Component @Controller
public class DeployController { public class DeployController {
@Value("${message.broker.host}") @Value("${message.broker.host}")
...@@ -162,7 +163,7 @@ public class DeployController { ...@@ -162,7 +163,7 @@ public class DeployController {
if (pro == null) { if (pro == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
String cloudConfID = pro.getCloudConfID(); String cloudConfID = pro.getCloudcloudCredentialsID();
CloudCredentials cCred = cloudCredentialsDao.findOne(cloudConfID); CloudCredentials cCred = cloudCredentialsDao.findOne(cloudConfID);
List<LoginKey> loginKeys = cCred.getLoginKeys(); List<LoginKey> loginKeys = cCred.getLoginKeys();
List<DeployParameter> deployParams = pro.getDeployParameters(); List<DeployParameter> deployParams = pro.getDeployParameters();
......
...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.PlannerService; import nl.uva.sne.drip.api.service.PlannerService;
import nl.uva.sne.drip.api.service.UserService; import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v1.types.Plan; import nl.uva.sne.drip.commons.v1.types.Plan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
...@@ -44,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -44,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestParam;
*/ */
@RestController @RestController
@RequestMapping("/user/v1.0/planner") @RequestMapping("/user/v1.0/planner")
@Component @Controller
public class PlannerController { public class PlannerController {
// @Autowired // @Autowired
......
...@@ -59,7 +59,7 @@ import nl.uva.sne.drip.commons.v1.types.CloudCredentials; ...@@ -59,7 +59,7 @@ import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter; import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.LoginKey; import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.Plan; import nl.uva.sne.drip.commons.v1.types.Plan;
import nl.uva.sne.drip.commons.v1.types.UserScript; import nl.uva.sne.drip.commons.v1.types.Script;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.json.JSONException; import org.json.JSONException;
...@@ -207,7 +207,7 @@ public class ProvisionController { ...@@ -207,7 +207,7 @@ public class ProvisionController {
private Message buildProvisionerMessage(ProvisionInfo pReq) throws JSONException, IOException { private Message buildProvisionerMessage(ProvisionInfo pReq) throws JSONException, IOException {
Message invokationMessage = new Message(); Message invokationMessage = new Message();
List<MessageParameter> parameters = new ArrayList(); List<MessageParameter> parameters = new ArrayList();
CloudCredentials cred = cloudCredentialsDao.findOne(pReq.getCloudConfID()); CloudCredentials cred = cloudCredentialsDao.findOne(pReq.getCloudcloudCredentialsID());
if (cred == null) { if (cred == null) {
throw new CloudCredentialsNotFoundException(); throw new CloudCredentialsNotFoundException();
} }
...@@ -220,7 +220,7 @@ public class ProvisionController { ...@@ -220,7 +220,7 @@ public class ProvisionController {
List<MessageParameter> topologies = buildTopologyParams(pReq.getPlanID()); List<MessageParameter> topologies = buildTopologyParams(pReq.getPlanID());
parameters.addAll(topologies); parameters.addAll(topologies);
String scriptID = pReq.getUserScriptID(); String scriptID = pReq.getscriptID();
if (scriptID != null) { if (scriptID != null) {
List<MessageParameter> userScripts = buildScriptParams(scriptID); List<MessageParameter> userScripts = buildScriptParams(scriptID);
parameters.addAll(userScripts); parameters.addAll(userScripts);
...@@ -281,7 +281,7 @@ public class ProvisionController { ...@@ -281,7 +281,7 @@ public class ProvisionController {
List<MessageParameter> parameters = new ArrayList(); List<MessageParameter> parameters = new ArrayList();
MessageParameter topology = new MessageParameter(); MessageParameter topology = new MessageParameter();
topology.setName("topology"); topology.setName("topology");
topology.setValue(Converter.map2YmlString(plan.getKvMap())); topology.setValue(Converter.map2YmlString(plan.getKeyValue()));
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("level", String.valueOf(plan.getLevel())); attributes.put("level", String.valueOf(plan.getLevel()));
attributes.put("filename", FilenameUtils.removeExtension(plan.getName())); attributes.put("filename", FilenameUtils.removeExtension(plan.getName()));
...@@ -293,7 +293,7 @@ public class ProvisionController { ...@@ -293,7 +293,7 @@ public class ProvisionController {
Plan lowPlan = planService.getDao().findOne(lowID); Plan lowPlan = planService.getDao().findOne(lowID);
topology = new MessageParameter(); topology = new MessageParameter();
topology.setName("topology"); topology.setName("topology");
topology.setValue(Converter.map2YmlString(lowPlan.getKvMap())); topology.setValue(Converter.map2YmlString(lowPlan.getKeyValue()));
attributes = new HashMap<>(); attributes = new HashMap<>();
attributes.put("level", String.valueOf(lowPlan.getLevel())); attributes.put("level", String.valueOf(lowPlan.getLevel()));
attributes.put("filename", FilenameUtils.removeExtension(lowPlan.getName())); attributes.put("filename", FilenameUtils.removeExtension(lowPlan.getName()));
...@@ -318,7 +318,7 @@ public class ProvisionController { ...@@ -318,7 +318,7 @@ public class ProvisionController {
} }
private List<MessageParameter> buildScriptParams(String userScriptID) { private List<MessageParameter> buildScriptParams(String userScriptID) {
UserScript script = userScriptService.getDao().findOne(userScriptID); Script script = userScriptService.getDao().findOne(userScriptID);
if (script == null) { if (script == null) {
throw new BadRequestException("User script: " + userScriptID + " was not found"); throw new BadRequestException("User script: " + userScriptID + " was not found");
} }
......
...@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import nl.uva.sne.drip.api.dao.UserScriptDao; import nl.uva.sne.drip.api.dao.UserScriptDao;
import nl.uva.sne.drip.api.exception.NotFoundException; import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.v1.types.UserScript; import nl.uva.sne.drip.commons.v1.types.Script;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
/** /**
...@@ -64,7 +64,7 @@ public class UserScriptController { ...@@ -64,7 +64,7 @@ public class UserScriptController {
byte[] bytes = file.getBytes(); byte[] bytes = file.getBytes();
String conents = new String(bytes, "UTF-8"); String conents = new String(bytes, "UTF-8");
UserScript us = new UserScript(); Script us = new Script();
us.setContents(conents); us.setContents(conents);
us.setName(name); us.setName(name);
...@@ -86,13 +86,13 @@ public class UserScriptController { ...@@ -86,13 +86,13 @@ public class UserScriptController {
*/ */
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
UserScript get(@PathVariable("id") String id) { Script get(@PathVariable("id") String id) {
return dao.findOne(id); return dao.findOne(id);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String delete(@PathVariable("id") String id) { public String delete(@PathVariable("id") String id) {
UserScript script = dao.findOne(id); Script script = dao.findOne(id);
if (script == null) { if (script == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
...@@ -108,9 +108,9 @@ public class UserScriptController { ...@@ -108,9 +108,9 @@ public class UserScriptController {
@RequestMapping(value = "/ids", method = RequestMethod.GET) @RequestMapping(value = "/ids", method = RequestMethod.GET)
public @ResponseBody public @ResponseBody
List<String> getIds() { List<String> getIds() {
List<UserScript> all = dao.findAll(); List<Script> all = dao.findAll();
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (UserScript us : all) { for (Script us : all) {
ids.add(us.getId()); ids.add(us.getId());
} }
return ids; return ids;
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v0.types;
/**
*
* @author S. Koulouzis
*/
public class Execute {
public String user;
public String pwd;
public String action;
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v0.types;
import java.util.List;
/**
*
* @author S. Koulouzis
*/
public class Upload {
public String user;
public String pwd;
List<File> file;
}
...@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Document @Document
public class CloudCredentials { public class CloudCredentials extends OwnedObject{
@Id @Id
private String id; private String id;
......
...@@ -29,7 +29,7 @@ public class ClusterCredentials { ...@@ -29,7 +29,7 @@ public class ClusterCredentials {
@Id @Id
private String id; private String id;
private String contents; private String key;
public String getId() { public String getId() {
return id; return id;
...@@ -43,19 +43,19 @@ public class ClusterCredentials { ...@@ -43,19 +43,19 @@ public class ClusterCredentials {
} }
/** /**
* The contents of the login key. * The key of the login key.
* @return the contents * @return the key
*/ */
@DocumentationExample("BEGINRSAPRIVATEKEY-----\\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3fVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm\\neNSse4zTg798ZA2kDMZFI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poFeUWrS5QArjtvNCm4SGlXw=\\n-----ENDRSAPRIVATEKEY-----\\n")
public String getContents() { public String getKey() {
return contents; return key;
} }
/** /**
* @param contents the contents to set * @param contents the key to set
*/ */
public void setContents(String contents) { public void setContents(String contents) {
this.contents = contents; this.key = contents;
} }
} }
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import java.util.Map;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
/**
*
* @author S. Koulouzis
*/
@Document
public class KeyValueHolder {
@Id
private String id;
private Map<String, Object> keyValue;
/**
* @return the keyValue
*/
public Map<String, Object> getKeyValue() {
return keyValue;
}
/**
* @param keyValue the keyValue to set
*/
public void setKvMap(Map<String, Object> keyValue) {
this.keyValue = keyValue;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import javax.validation.constraints.NotNull;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.stereotype.Component;
/**
*
* @author S. Koulouzis
*/
@Document
public class OwnedObject {
@NotNull
private String owner;
@NotNull
private Permissions permissions;
/**
* @return the permissions
*/
public Permissions getPermissions() {
return permissions;
}
/**
* @param permissions the permissions to set
*/
public void setPermissions(Permissions permissions) {
this.permissions = permissions;
}
/**
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* @param owner the ownerID to set
*/
public void setOwner(String owner) {
this.owner = owner;
}
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import java.util.Set;
import javax.validation.constraints.NotNull;
import org.springframework.data.mongodb.core.mapping.Document;
/**
*
* @author S. Koulouzis
*/
@Document
public class Permissions {
private Set<String> read;
private Set<String> write;
/**
* @return the read
*/
public Set<String> getRead() {
return read;
}
/**
* @param read the read to set
*/
public void setRead(Set<String> read) {
this.read = read;
}
/**
* @return the write
*/
public Set<String> getWrite() {
return write;
}
/**
* @param write the write to set
*/
public void setWrite(Set<String> write) {
this.write = write;
}
}
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
*/ */
package nl.uva.sne.drip.commons.v1.types; package nl.uva.sne.drip.commons.v1.types;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
/** /**
...@@ -27,10 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -27,10 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Document @Document
public class Plan { public class Plan extends KeyValueHolder {
@Id
private String id;
private String toscaID; private String toscaID;
...@@ -40,31 +35,6 @@ public class Plan { ...@@ -40,31 +35,6 @@ public class Plan {
private Set<String> loweLevelPlansIDs; private Set<String> loweLevelPlansIDs;
private Map<String, Object> kvMap;
public final String getId() {
return id;
}
public final void setId(final String id) {
this.id = id;
}
/**
*
* @return the kvMap
*/
public Map<String, Object> getKvMap() {
return kvMap;
}
/**
* @param kvMap the kvMap to set
*/
public void setKvMap(Map<String, Object> kvMap) {
this.kvMap = kvMap;
}
/** /**
* @return the name * @return the name
*/ */
...@@ -114,9 +84,6 @@ public class Plan { ...@@ -114,9 +84,6 @@ public class Plan {
return loweLevelPlansIDs; return loweLevelPlansIDs;
} }
/**
* @param loweLevelPlans the loweLevelPlansIDs to set
*/
public void setLoweLevelPlansIDs(Set<String> loweLevelPlansIDs) { public void setLoweLevelPlansIDs(Set<String> loweLevelPlansIDs) {
this.loweLevelPlansIDs = loweLevelPlansIDs; this.loweLevelPlansIDs = loweLevelPlansIDs;
} }
......
...@@ -16,41 +16,37 @@ ...@@ -16,41 +16,37 @@
package nl.uva.sne.drip.commons.v1.types; package nl.uva.sne.drip.commons.v1.types;
import java.util.List; import java.util.List;
import java.util.Map; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.annotation.Id;
/** /**
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
public class ProvisionInfo { @Document
public class ProvisionInfo extends KeyValueHolder {
@Id private String cloudCredentialsID;
private String id;
private String cloudConfID;
private String planID; private String planID;
private String userScriptID; private String scriptID;
private String userKeyID; private String userKeyID;
private Map<String, Object> kvMap;
private List<DeployParameter> deployParameters; private List<DeployParameter> deployParameters;
/** /**
* @return the cloudConfID * @return the cloudCredentialsID
*/ */
public String getCloudConfID() { public String getCloudcloudCredentialsID() {
return cloudConfID; return cloudCredentialsID;
} }
/** /**
* @param cloudConfID the cloudConfID to set * @param cloudConfID the cloudCredentialsID to set
*/ */
public void setCloudConfID(String cloudConfID) { public void setCloudcloudCredentialsID(String cloudConfID) {
this.cloudConfID = cloudConfID; this.cloudCredentialsID = cloudConfID;
} }
/** /**
...@@ -68,17 +64,17 @@ public class ProvisionInfo { ...@@ -68,17 +64,17 @@ public class ProvisionInfo {
} }
/** /**
* @return the userScriptID * @return the scriptID
*/ */
public String getUserScriptID() { public String getscriptID() {
return userScriptID; return scriptID;
} }
/** /**
* @param userScriptID the userScriptID to set * @param scriptID the scriptID to set
*/ */
public void setUserScriptID(String userScriptID) { public void setScriptID(String scriptID) {
this.userScriptID = userScriptID; this.scriptID = scriptID;
} }
/** /**
...@@ -95,33 +91,7 @@ public class ProvisionInfo { ...@@ -95,33 +91,7 @@ public class ProvisionInfo {
this.userKeyID = userKeyID; this.userKeyID = userKeyID;
} }
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the kvMap
*/
public Map<String, Object> getKvMap() {
return kvMap;
}
/**
* @param kvMap the kvMap to set
*/
public void setKvMap(Map<String, Object> kvMap) {
this.kvMap = kvMap;
}
public void setDeployParameters(List<DeployParameter> deployParameters) { public void setDeployParameters(List<DeployParameter> deployParameters) {
this.deployParameters = deployParameters; this.deployParameters = deployParameters;
......
...@@ -25,7 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -25,7 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Document @Document
public class UserScript { public class Script {
@Id @Id
private String id; private String id;
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import org.springframework.stereotype.Component;
/**
*
* @author S. Koulouzis
*/
@Component
public class TestBean {
public boolean getTestBoolean() {
return false;
}
}
...@@ -24,37 +24,10 @@ import org.springframework.data.mongodb.core.mapping.Document; ...@@ -24,37 +24,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Document @Document
public class ToscaRepresentation { public class ToscaRepresentation extends KeyValueHolder {
@Id
private String id;
private String name; private String name;
private Map<String, Object> kvMap;
public final String getId() {
return id;
}
public final void setId(final String id) {
this.id = id;
}
/**
* @return the kvMap
*/
public Map<String, Object> getKvMap() {
return kvMap;
}
/**
* @param kvMap the kvMap to set
*/
public void setKvMap(Map<String, Object> kvMap) {
this.kvMap = kvMap;
}
/** /**
* @return the name * @return the name
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment