1 23 24 package org.apache.slide.projector.processor.security; 25 26 import java.util.Map ; 27 28 import org.apache.slide.projector.Context; 29 import org.apache.slide.projector.Processor; 30 import org.apache.slide.projector.Projector; 31 import org.apache.slide.projector.Result; 32 import org.apache.slide.projector.URI; 33 import org.apache.slide.projector.descriptor.ParameterDescriptor; 34 import org.apache.slide.projector.descriptor.ResultDescriptor; 35 import org.apache.slide.projector.descriptor.StateDescriptor; 36 import org.apache.slide.projector.descriptor.URIValueDescriptor; 37 import org.apache.slide.projector.i18n.ParameterMessage; 38 39 43 public class RemoveRole implements Processor { 44 public final static String USER = "user"; 45 public final static String ROLE = "role"; 46 47 private final static ParameterDescriptor[] parameterDescriptors = new ParameterDescriptor[] { 48 new ParameterDescriptor(USER, new ParameterMessage("addRole/parameter/user"), new URIValueDescriptor()), 49 new ParameterDescriptor(ROLE, new ParameterMessage("addRole/parameter/role"), new URIValueDescriptor()) 50 }; 51 private final static ResultDescriptor resultDescriptor = new ResultDescriptor(new StateDescriptor[] { StateDescriptor.OK_DESCRIPTOR }); 52 53 public Result process(Map parameter, Context context) throws Exception { 54 URI user = (URI)parameter.get(USER); 55 URI role = (URI)parameter.get(ROLE); 56 Projector.getRepository().removeRole(user, role, context.getCredentials()); 57 return Result.OK; 58 } 59 60 public ParameterDescriptor[] getParameterDescriptors() { 61 return parameterDescriptors; 62 } 63 64 public ResultDescriptor getResultDescriptor() { 65 return resultDescriptor; 66 } 67 } | Popular Tags |