diff --git a/config/alfresco/model/permissionDefinitions.xml b/config/alfresco/model/permissionDefinitions.xml index 72e0226d8a..b6e956cba3 100644 --- a/config/alfresco/model/permissionDefinitions.xml +++ b/config/alfresco/model/permissionDefinitions.xml @@ -406,49 +406,49 @@ - + --> - + --> - + --> - + --> - + --> - + --> - + --> diff --git a/config/alfresco/public-services-security-context.xml b/config/alfresco/public-services-security-context.xml index c48ef6c53f..28f3553a6f 100644 --- a/config/alfresco/public-services-security-context.xml +++ b/config/alfresco/public-services-security-context.xml @@ -22,9 +22,6 @@ alfresco/model/permissionDefinitions.xml - - alfresco/model/permissionSchema.dtd - diff --git a/source/java/org/alfresco/repo/security/permissions/impl/model/PermissionModel.java b/source/java/org/alfresco/repo/security/permissions/impl/model/PermissionModel.java index 56eb9bbe04..48bb02cc40 100644 --- a/source/java/org/alfresco/repo/security/permissions/impl/model/PermissionModel.java +++ b/source/java/org/alfresco/repo/security/permissions/impl/model/PermissionModel.java @@ -18,11 +18,8 @@ */ package org.alfresco.repo.security.permissions.impl.model; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.util.Collection; import java.util.Collections; import java.util.EnumMap; @@ -53,15 +50,11 @@ import org.alfresco.service.namespace.DynamicNamespacePrefixResolver; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.util.Pair; -import org.alfresco.util.TempFileProvider; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; -import org.dom4j.DocumentType; import org.dom4j.Element; import org.dom4j.io.SAXReader; -import org.dom4j.tree.DefaultDocumentType; -import org.springframework.util.FileCopyUtils; /** * The implementation of the model DAO Reads and stores the top level model information Encapsulates access to this @@ -100,8 +93,6 @@ public class PermissionModel implements ModelDAO // Instance variables private String model; - private String dtdSchema; - private boolean validate = true; /* * (non-Javadoc) @@ -1151,26 +1142,6 @@ public class PermissionModel implements ModelDAO this.model = model; } - /** - * Set the dtd schema that is used to validate permission model - * - * @param dtdSchema - */ - public void setDtdSchema(String dtdSchema) - { - this.dtdSchema = dtdSchema; - } - - /** - * Indicates whether model should be validated on initialization against specified dtd - * - * @param validate - */ - public void setValidate(boolean validate) - { - this.validate = validate; - } - /** * Set the dictionary service * @@ -1290,7 +1261,6 @@ public class PermissionModel implements ModelDAO private Document createDocument(String model) { InputStream is = this.getClass().getClassLoader().getResourceAsStream(model); - URL dtdSchemaUrl = this.getClass().getClassLoader().getResource(dtdSchema); if (is == null) { throw new PermissionModelException("File not found: " + model); @@ -1298,63 +1268,21 @@ public class PermissionModel implements ModelDAO SAXReader reader = new SAXReader(); try { - if (validate) - { - if (dtdSchemaUrl != null) - { - is = processModelDocType(is, dtdSchemaUrl.toString()); - reader.setValidation(true); - } - else - { - throw new PermissionModelException("Couldn't obtain DTD schema to validate permission model."); - } - } - Document document = reader.read(is); is.close(); return document; } catch (DocumentException e) { - throw new PermissionModelException("Failed to create permission model document: " + model, e); + throw new PermissionModelException("Failed to create permission model document ", e); } catch (IOException e) { - throw new PermissionModelException("Failed to close permission model document: " + model, e); + throw new PermissionModelException("Failed to close permission model document ", e); } } - /* - * Replace or add correct DOCTYPE to the xml to allow validation against dtd - */ - private InputStream processModelDocType(InputStream is, String dtdSchemaUrl) throws DocumentException, IOException - { - SAXReader reader = new SAXReader(); - // read document without validation - Document doc = reader.read(is); - DocumentType docType = doc.getDocType(); - if (docType != null) - { - // replace DOCTYPE setting the full path to the xsd - docType.setSystemID(dtdSchemaUrl); - } - else - { - // add the DOCTYPE - docType = new DefaultDocumentType(doc.getRootElement().getName(), dtdSchemaUrl); - doc.setDocType(docType); - } - - File tempFile = TempFileProvider.createTempFile("permissionModel-", ".tmp"); - - // copy the modified permission model to the temp file - FileCopyUtils.copy(doc.asXML().getBytes(), tempFile); - - return new FileInputStream(tempFile); - } - /** * Set the default access status *