Commit 4767b104 authored by Peter Harrison's avatar Peter Harrison

Adding permissions to API in CardController

Modify EmailSenderAction to resolve issue
parent 17ba9afc
......@@ -31,7 +31,7 @@ public class EmailSenderAction {
private static final Logger logger = LoggerFactory.getLogger(EmailSenderAction.class);
protected void sendEmail(String subject, String emailBody, String to, String bcc, String from, String replyTo,String host){
public void sendEmail(String subject, String emailBody, String to, String bcc, String from, String replyTo,String host){
SimpleMailMessage mailMessage = new SimpleMailMessage();
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(host);
......
......@@ -108,6 +108,30 @@ public class ExecutionPlugin implements Plugin {
try{
response = method.invoke(plugin,parameterValueArray);
} catch( NullPointerException e) {
//Class<?>[] types = method.getParameterTypes();
StringBuilder b = new StringBuilder();
b.append("No Method Found:");
int f = parameterValueArray.length;
for( int a=0; a<f; a++){
Object o = parameterValueArray[a];
if( o==null){
b.append(" (index ");
b.append(a+1);
b.append("=null?)");
} else {
Class paramType = o.getClass();
b.append(" (index ");
b.append(a+1);
b.append("=");
b.append(o.toString());
b.append(" (");
b.append(paramType.getName());
b.append(" )");
}
}
throw new IllegalArgumentException( b.toString(), e);
} catch( IllegalArgumentException e) {
Class<?>[] types = method.getParameterTypes();
StringBuilder b = new StringBuilder();
......
......@@ -474,12 +474,14 @@ public class BoardController {
}
@PreAuthorize("hasPermission(#boardId, 'BOARD', 'READ,WRITE,ADMIN')")
@RequestMapping(value = "/{boardId}/roles", method=RequestMethod.GET)
public @ResponseBody Map<String,String> getRoles(@PathVariable String boardId) throws Exception {
Board board = boardsCache.getItem(boardId);
return board.getRoles();
}
@PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
@RequestMapping(value = "/{boardId}/roles", method=RequestMethod.POST)
public @ResponseBody void addRoles(@PathVariable String boardId, @RequestBody Map<String,String> roles) throws Exception {
......@@ -503,6 +505,7 @@ public class BoardController {
}
}
@PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
@RequestMapping(value = "/{boardId}/roles/{member}", method=RequestMethod.DELETE)
public @ResponseBody void deleteRole(@PathVariable String boardId, @PathVariable String member) throws Exception {
......@@ -616,7 +619,6 @@ public class BoardController {
logger.info("Setting Scope: " + boardId +"," + phaseId + "," + cardId);
String scope = String.format(URI.HISTORY_URI, boardId, phaseId, IdentifierTools.escapeNumber(cardId), "/");
//String scope = String.format(URI.HISTORY_URI, boardId, phaseId, cardId, "/");
logger.info("Setting Scope: " + scope);
......@@ -766,7 +768,5 @@ public class BoardController {
logger.info("Complete with :"+returnList.size());
return returnList;
}
}
}
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