RM-2120: Add Java backed webscript to set the security clearance for a specified user

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@103827 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Webster
2015-05-07 14:01:56 +00:00
parent 98155a3147
commit 35afc42a8c
4 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.script.classification;
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Implementation for Java backed webscript to set users security clearance.
*
* @author David Webster
* @author Tom Page
* @since 3.0
*/
public class UserSecurityClearancePut extends AbstractRmWebScript
{
/** Constants */
private static final String USERNAME = "username";
private static final String CLEARANCE_ID = "clearanceId";
private static final String ITEM = "item";
/** Security clearance service */
private SecurityClearanceService securityClearanceService;
/**
* @param securityClearanceService the securityClearanceService to set
*/
public void setSecurityClearanceService(SecurityClearanceService securityClearanceService)
{
this.securityClearanceService = securityClearanceService;
}
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest,
* org.springframework.extensions.webscripts.Status,
* org.springframework.extensions.webscripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
String username = req.getParameter(USERNAME);
String clearanceId = req.getParameter(CLEARANCE_ID);
SecurityClearance securityClearance = securityClearanceService.setUserSecurityClearance(username, clearanceId);
Map<String, Object> model = new HashMap<>();
model.put(ITEM, securityClearance);
return model;
}
}