mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
- Addition of copyToNew flag to onCopyComplete policy for Gav
- Implementation and unit tests for admin web service - Implementation and unit tests for access control web service git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2222 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -10,7 +10,7 @@ package org.alfresco.repo.webservice.accesscontrol;
|
|||||||
public class ACE implements java.io.Serializable {
|
public class ACE implements java.io.Serializable {
|
||||||
private java.lang.String authority;
|
private java.lang.String authority;
|
||||||
private java.lang.String permission;
|
private java.lang.String permission;
|
||||||
private boolean allow;
|
private org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus;
|
||||||
|
|
||||||
public ACE() {
|
public ACE() {
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,10 @@ public class ACE implements java.io.Serializable {
|
|||||||
public ACE(
|
public ACE(
|
||||||
java.lang.String authority,
|
java.lang.String authority,
|
||||||
java.lang.String permission,
|
java.lang.String permission,
|
||||||
boolean allow) {
|
org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus) {
|
||||||
this.authority = authority;
|
this.authority = authority;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.allow = allow;
|
this.accessStatus = accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,22 +66,22 @@ public class ACE implements java.io.Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the allow value for this ACE.
|
* Gets the accessStatus value for this ACE.
|
||||||
*
|
*
|
||||||
* @return allow
|
* @return accessStatus
|
||||||
*/
|
*/
|
||||||
public boolean isAllow() {
|
public org.alfresco.repo.webservice.accesscontrol.AccessStatus getAccessStatus() {
|
||||||
return allow;
|
return accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the allow value for this ACE.
|
* Sets the accessStatus value for this ACE.
|
||||||
*
|
*
|
||||||
* @param allow
|
* @param accessStatus
|
||||||
*/
|
*/
|
||||||
public void setAllow(boolean allow) {
|
public void setAccessStatus(org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus) {
|
||||||
this.allow = allow;
|
this.accessStatus = accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private java.lang.Object __equalsCalc = null;
|
private java.lang.Object __equalsCalc = null;
|
||||||
@@ -102,7 +102,9 @@ public class ACE implements java.io.Serializable {
|
|||||||
((this.permission==null && other.getPermission()==null) ||
|
((this.permission==null && other.getPermission()==null) ||
|
||||||
(this.permission!=null &&
|
(this.permission!=null &&
|
||||||
this.permission.equals(other.getPermission()))) &&
|
this.permission.equals(other.getPermission()))) &&
|
||||||
this.allow == other.isAllow();
|
((this.accessStatus==null && other.getAccessStatus()==null) ||
|
||||||
|
(this.accessStatus!=null &&
|
||||||
|
this.accessStatus.equals(other.getAccessStatus())));
|
||||||
__equalsCalc = null;
|
__equalsCalc = null;
|
||||||
return _equals;
|
return _equals;
|
||||||
}
|
}
|
||||||
@@ -120,7 +122,9 @@ public class ACE implements java.io.Serializable {
|
|||||||
if (getPermission() != null) {
|
if (getPermission() != null) {
|
||||||
_hashCode += getPermission().hashCode();
|
_hashCode += getPermission().hashCode();
|
||||||
}
|
}
|
||||||
_hashCode += (isAllow() ? Boolean.TRUE : Boolean.FALSE).hashCode();
|
if (getAccessStatus() != null) {
|
||||||
|
_hashCode += getAccessStatus().hashCode();
|
||||||
|
}
|
||||||
__hashCodeCalc = false;
|
__hashCodeCalc = false;
|
||||||
return _hashCode;
|
return _hashCode;
|
||||||
}
|
}
|
||||||
@@ -144,9 +148,9 @@ public class ACE implements java.io.Serializable {
|
|||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
elemField = new org.apache.axis.description.ElementDesc();
|
elemField = new org.apache.axis.description.ElementDesc();
|
||||||
elemField.setFieldName("allow");
|
elemField.setFieldName("accessStatus");
|
||||||
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "allow"));
|
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "accessStatus"));
|
||||||
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
|
elemField.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "AccessStatus"));
|
||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
}
|
}
|
||||||
|
@@ -32,13 +32,13 @@ public interface AccessControlServiceSoapPort extends java.rmi.Remote {
|
|||||||
/**
|
/**
|
||||||
* Gets a list of the settable permissions for a list of classes.
|
* Gets a list of the settable permissions for a list of classes.
|
||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.accesscontrol.GetPermissionsResult[] getClassPermissions(java.lang.String[] classNames) throws java.rmi.RemoteException, org.alfresco.repo.webservice.accesscontrol.AccessControlFault;
|
public org.alfresco.repo.webservice.accesscontrol.GetClassPermissionsResult[] getClassPermissions(java.lang.String[] classNames) throws java.rmi.RemoteException, org.alfresco.repo.webservice.accesscontrol.AccessControlFault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the current authenticated user has the permissions
|
* Determines whether the current authenticated user has the permissions
|
||||||
* on each of the specified references.
|
* on each of the specified references.
|
||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.accesscontrol.HasPermissionsResult hasPermissions(org.alfresco.repo.webservice.types.Predicate predicate, java.lang.String[] permissions) throws java.rmi.RemoteException, org.alfresco.repo.webservice.accesscontrol.AccessControlFault;
|
public org.alfresco.repo.webservice.accesscontrol.HasPermissionsResult[] hasPermissions(org.alfresco.repo.webservice.types.Predicate predicate, java.lang.String[] permissions) throws java.rmi.RemoteException, org.alfresco.repo.webservice.accesscontrol.AccessControlFault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the inherit permission property of a set of references.
|
* Set the inherit permission property of a set of references.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* AccessState.java
|
* AccessStatus.java
|
||||||
*
|
*
|
||||||
* This file was auto-generated from WSDL
|
* This file was auto-generated from WSDL
|
||||||
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
|
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
|
||||||
@@ -7,29 +7,29 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.webservice.accesscontrol;
|
package org.alfresco.repo.webservice.accesscontrol;
|
||||||
|
|
||||||
public class AccessState implements java.io.Serializable {
|
public class AccessStatus implements java.io.Serializable {
|
||||||
private java.lang.String _value_;
|
private java.lang.String _value_;
|
||||||
private static java.util.HashMap _table_ = new java.util.HashMap();
|
private static java.util.HashMap _table_ = new java.util.HashMap();
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
protected AccessState(java.lang.String value) {
|
protected AccessStatus(java.lang.String value) {
|
||||||
_value_ = value;
|
_value_ = value;
|
||||||
_table_.put(_value_,this);
|
_table_.put(_value_,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final java.lang.String _acepted = "acepted";
|
public static final java.lang.String _acepted = "acepted";
|
||||||
public static final java.lang.String _declined = "declined";
|
public static final java.lang.String _declined = "declined";
|
||||||
public static final AccessState acepted = new AccessState(_acepted);
|
public static final AccessStatus acepted = new AccessStatus(_acepted);
|
||||||
public static final AccessState declined = new AccessState(_declined);
|
public static final AccessStatus declined = new AccessStatus(_declined);
|
||||||
public java.lang.String getValue() { return _value_;}
|
public java.lang.String getValue() { return _value_;}
|
||||||
public static AccessState fromValue(java.lang.String value)
|
public static AccessStatus fromValue(java.lang.String value)
|
||||||
throws java.lang.IllegalArgumentException {
|
throws java.lang.IllegalArgumentException {
|
||||||
AccessState enumeration = (AccessState)
|
AccessStatus enumeration = (AccessStatus)
|
||||||
_table_.get(value);
|
_table_.get(value);
|
||||||
if (enumeration==null) throw new java.lang.IllegalArgumentException();
|
if (enumeration==null) throw new java.lang.IllegalArgumentException();
|
||||||
return enumeration;
|
return enumeration;
|
||||||
}
|
}
|
||||||
public static AccessState fromString(java.lang.String value)
|
public static AccessStatus fromString(java.lang.String value)
|
||||||
throws java.lang.IllegalArgumentException {
|
throws java.lang.IllegalArgumentException {
|
||||||
return fromValue(value);
|
return fromValue(value);
|
||||||
}
|
}
|
||||||
@@ -55,10 +55,10 @@ public class AccessState implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
// Type metadata
|
// Type metadata
|
||||||
private static org.apache.axis.description.TypeDesc typeDesc =
|
private static org.apache.axis.description.TypeDesc typeDesc =
|
||||||
new org.apache.axis.description.TypeDesc(AccessState.class);
|
new org.apache.axis.description.TypeDesc(AccessStatus.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "AccessState"));
|
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "AccessStatus"));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return type metadata object
|
* Return type metadata object
|
@@ -9,14 +9,14 @@ package org.alfresco.repo.webservice.accesscontrol;
|
|||||||
|
|
||||||
public class GetClassPermissionsResult implements java.io.Serializable {
|
public class GetClassPermissionsResult implements java.io.Serializable {
|
||||||
private java.lang.String className;
|
private java.lang.String className;
|
||||||
private java.lang.String permissions;
|
private java.lang.String[] permissions;
|
||||||
|
|
||||||
public GetClassPermissionsResult() {
|
public GetClassPermissionsResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetClassPermissionsResult(
|
public GetClassPermissionsResult(
|
||||||
java.lang.String className,
|
java.lang.String className,
|
||||||
java.lang.String permissions) {
|
java.lang.String[] permissions) {
|
||||||
this.className = className;
|
this.className = className;
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ public class GetClassPermissionsResult implements java.io.Serializable {
|
|||||||
*
|
*
|
||||||
* @return permissions
|
* @return permissions
|
||||||
*/
|
*/
|
||||||
public java.lang.String getPermissions() {
|
public java.lang.String[] getPermissions() {
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +57,18 @@ public class GetClassPermissionsResult implements java.io.Serializable {
|
|||||||
*
|
*
|
||||||
* @param permissions
|
* @param permissions
|
||||||
*/
|
*/
|
||||||
public void setPermissions(java.lang.String permissions) {
|
public void setPermissions(java.lang.String[] permissions) {
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public java.lang.String getPermissions(int i) {
|
||||||
|
return this.permissions[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(int i, java.lang.String _value) {
|
||||||
|
this.permissions[i] = _value;
|
||||||
|
}
|
||||||
|
|
||||||
private java.lang.Object __equalsCalc = null;
|
private java.lang.Object __equalsCalc = null;
|
||||||
public synchronized boolean equals(java.lang.Object obj) {
|
public synchronized boolean equals(java.lang.Object obj) {
|
||||||
if (!(obj instanceof GetClassPermissionsResult)) return false;
|
if (!(obj instanceof GetClassPermissionsResult)) return false;
|
||||||
@@ -78,7 +86,7 @@ public class GetClassPermissionsResult implements java.io.Serializable {
|
|||||||
this.className.equals(other.getClassName()))) &&
|
this.className.equals(other.getClassName()))) &&
|
||||||
((this.permissions==null && other.getPermissions()==null) ||
|
((this.permissions==null && other.getPermissions()==null) ||
|
||||||
(this.permissions!=null &&
|
(this.permissions!=null &&
|
||||||
this.permissions.equals(other.getPermissions())));
|
java.util.Arrays.equals(this.permissions, other.getPermissions())));
|
||||||
__equalsCalc = null;
|
__equalsCalc = null;
|
||||||
return _equals;
|
return _equals;
|
||||||
}
|
}
|
||||||
@@ -94,7 +102,15 @@ public class GetClassPermissionsResult implements java.io.Serializable {
|
|||||||
_hashCode += getClassName().hashCode();
|
_hashCode += getClassName().hashCode();
|
||||||
}
|
}
|
||||||
if (getPermissions() != null) {
|
if (getPermissions() != null) {
|
||||||
_hashCode += getPermissions().hashCode();
|
for (int i=0;
|
||||||
|
i<java.lang.reflect.Array.getLength(getPermissions());
|
||||||
|
i++) {
|
||||||
|
java.lang.Object obj = java.lang.reflect.Array.get(getPermissions(), i);
|
||||||
|
if (obj != null &&
|
||||||
|
!obj.getClass().isArray()) {
|
||||||
|
_hashCode += obj.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__hashCodeCalc = false;
|
__hashCodeCalc = false;
|
||||||
return _hashCode;
|
return _hashCode;
|
||||||
@@ -118,6 +134,7 @@ public class GetClassPermissionsResult implements java.io.Serializable {
|
|||||||
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
|
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
|
||||||
elemField.setMinOccurs(0);
|
elemField.setMinOccurs(0);
|
||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
|
elemField.setMaxOccursUnbounded(true);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,14 +9,14 @@ package org.alfresco.repo.webservice.accesscontrol;
|
|||||||
|
|
||||||
public class GetPermissionsResult implements java.io.Serializable {
|
public class GetPermissionsResult implements java.io.Serializable {
|
||||||
private org.alfresco.repo.webservice.types.Reference reference;
|
private org.alfresco.repo.webservice.types.Reference reference;
|
||||||
private java.lang.String permissions;
|
private java.lang.String[] permissions;
|
||||||
|
|
||||||
public GetPermissionsResult() {
|
public GetPermissionsResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetPermissionsResult(
|
public GetPermissionsResult(
|
||||||
org.alfresco.repo.webservice.types.Reference reference,
|
org.alfresco.repo.webservice.types.Reference reference,
|
||||||
java.lang.String permissions) {
|
java.lang.String[] permissions) {
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ public class GetPermissionsResult implements java.io.Serializable {
|
|||||||
*
|
*
|
||||||
* @return permissions
|
* @return permissions
|
||||||
*/
|
*/
|
||||||
public java.lang.String getPermissions() {
|
public java.lang.String[] getPermissions() {
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +57,18 @@ public class GetPermissionsResult implements java.io.Serializable {
|
|||||||
*
|
*
|
||||||
* @param permissions
|
* @param permissions
|
||||||
*/
|
*/
|
||||||
public void setPermissions(java.lang.String permissions) {
|
public void setPermissions(java.lang.String[] permissions) {
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public java.lang.String getPermissions(int i) {
|
||||||
|
return this.permissions[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(int i, java.lang.String _value) {
|
||||||
|
this.permissions[i] = _value;
|
||||||
|
}
|
||||||
|
|
||||||
private java.lang.Object __equalsCalc = null;
|
private java.lang.Object __equalsCalc = null;
|
||||||
public synchronized boolean equals(java.lang.Object obj) {
|
public synchronized boolean equals(java.lang.Object obj) {
|
||||||
if (!(obj instanceof GetPermissionsResult)) return false;
|
if (!(obj instanceof GetPermissionsResult)) return false;
|
||||||
@@ -78,7 +86,7 @@ public class GetPermissionsResult implements java.io.Serializable {
|
|||||||
this.reference.equals(other.getReference()))) &&
|
this.reference.equals(other.getReference()))) &&
|
||||||
((this.permissions==null && other.getPermissions()==null) ||
|
((this.permissions==null && other.getPermissions()==null) ||
|
||||||
(this.permissions!=null &&
|
(this.permissions!=null &&
|
||||||
this.permissions.equals(other.getPermissions())));
|
java.util.Arrays.equals(this.permissions, other.getPermissions())));
|
||||||
__equalsCalc = null;
|
__equalsCalc = null;
|
||||||
return _equals;
|
return _equals;
|
||||||
}
|
}
|
||||||
@@ -94,7 +102,15 @@ public class GetPermissionsResult implements java.io.Serializable {
|
|||||||
_hashCode += getReference().hashCode();
|
_hashCode += getReference().hashCode();
|
||||||
}
|
}
|
||||||
if (getPermissions() != null) {
|
if (getPermissions() != null) {
|
||||||
_hashCode += getPermissions().hashCode();
|
for (int i=0;
|
||||||
|
i<java.lang.reflect.Array.getLength(getPermissions());
|
||||||
|
i++) {
|
||||||
|
java.lang.Object obj = java.lang.reflect.Array.get(getPermissions(), i);
|
||||||
|
if (obj != null &&
|
||||||
|
!obj.getClass().isArray()) {
|
||||||
|
_hashCode += obj.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__hashCodeCalc = false;
|
__hashCodeCalc = false;
|
||||||
return _hashCode;
|
return _hashCode;
|
||||||
@@ -118,6 +134,7 @@ public class GetPermissionsResult implements java.io.Serializable {
|
|||||||
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
|
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
|
||||||
elemField.setMinOccurs(0);
|
elemField.setMinOccurs(0);
|
||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
|
elemField.setMaxOccursUnbounded(true);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ package org.alfresco.repo.webservice.accesscontrol;
|
|||||||
public class HasPermissionsResult implements java.io.Serializable {
|
public class HasPermissionsResult implements java.io.Serializable {
|
||||||
private org.alfresco.repo.webservice.types.Reference reference;
|
private org.alfresco.repo.webservice.types.Reference reference;
|
||||||
private java.lang.String permission;
|
private java.lang.String permission;
|
||||||
private org.alfresco.repo.webservice.accesscontrol.AccessState accessState;
|
private org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus;
|
||||||
|
|
||||||
public HasPermissionsResult() {
|
public HasPermissionsResult() {
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,10 @@ public class HasPermissionsResult implements java.io.Serializable {
|
|||||||
public HasPermissionsResult(
|
public HasPermissionsResult(
|
||||||
org.alfresco.repo.webservice.types.Reference reference,
|
org.alfresco.repo.webservice.types.Reference reference,
|
||||||
java.lang.String permission,
|
java.lang.String permission,
|
||||||
org.alfresco.repo.webservice.accesscontrol.AccessState accessState) {
|
org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus) {
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
this.accessState = accessState;
|
this.accessStatus = accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,22 +66,22 @@ public class HasPermissionsResult implements java.io.Serializable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the accessState value for this HasPermissionsResult.
|
* Gets the accessStatus value for this HasPermissionsResult.
|
||||||
*
|
*
|
||||||
* @return accessState
|
* @return accessStatus
|
||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.accesscontrol.AccessState getAccessState() {
|
public org.alfresco.repo.webservice.accesscontrol.AccessStatus getAccessStatus() {
|
||||||
return accessState;
|
return accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the accessState value for this HasPermissionsResult.
|
* Sets the accessStatus value for this HasPermissionsResult.
|
||||||
*
|
*
|
||||||
* @param accessState
|
* @param accessStatus
|
||||||
*/
|
*/
|
||||||
public void setAccessState(org.alfresco.repo.webservice.accesscontrol.AccessState accessState) {
|
public void setAccessStatus(org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus) {
|
||||||
this.accessState = accessState;
|
this.accessStatus = accessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private java.lang.Object __equalsCalc = null;
|
private java.lang.Object __equalsCalc = null;
|
||||||
@@ -102,9 +102,9 @@ public class HasPermissionsResult implements java.io.Serializable {
|
|||||||
((this.permission==null && other.getPermission()==null) ||
|
((this.permission==null && other.getPermission()==null) ||
|
||||||
(this.permission!=null &&
|
(this.permission!=null &&
|
||||||
this.permission.equals(other.getPermission()))) &&
|
this.permission.equals(other.getPermission()))) &&
|
||||||
((this.accessState==null && other.getAccessState()==null) ||
|
((this.accessStatus==null && other.getAccessStatus()==null) ||
|
||||||
(this.accessState!=null &&
|
(this.accessStatus!=null &&
|
||||||
this.accessState.equals(other.getAccessState())));
|
this.accessStatus.equals(other.getAccessStatus())));
|
||||||
__equalsCalc = null;
|
__equalsCalc = null;
|
||||||
return _equals;
|
return _equals;
|
||||||
}
|
}
|
||||||
@@ -122,8 +122,8 @@ public class HasPermissionsResult implements java.io.Serializable {
|
|||||||
if (getPermission() != null) {
|
if (getPermission() != null) {
|
||||||
_hashCode += getPermission().hashCode();
|
_hashCode += getPermission().hashCode();
|
||||||
}
|
}
|
||||||
if (getAccessState() != null) {
|
if (getAccessStatus() != null) {
|
||||||
_hashCode += getAccessState().hashCode();
|
_hashCode += getAccessStatus().hashCode();
|
||||||
}
|
}
|
||||||
__hashCodeCalc = false;
|
__hashCodeCalc = false;
|
||||||
return _hashCode;
|
return _hashCode;
|
||||||
@@ -148,9 +148,9 @@ public class HasPermissionsResult implements java.io.Serializable {
|
|||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
elemField = new org.apache.axis.description.ElementDesc();
|
elemField = new org.apache.axis.description.ElementDesc();
|
||||||
elemField.setFieldName("accessState");
|
elemField.setFieldName("accessStatus");
|
||||||
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "accessState"));
|
elemField.setXmlName(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "accessStatus"));
|
||||||
elemField.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "AccessState"));
|
elemField.setXmlType(new javax.xml.namespace.QName("http://www.alfresco.org/ws/service/accesscontrol/1.0", "AccessStatus"));
|
||||||
elemField.setNillable(false);
|
elemField.setNillable(false);
|
||||||
typeDesc.addFieldDesc(elemField);
|
typeDesc.addFieldDesc(elemField);
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
<parameter qname="pns:predicate" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:Predicate" xmlns:tns="http://www.alfresco.org/ws/model/content/1.0"/>
|
<parameter qname="pns:predicate" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:Predicate" xmlns:tns="http://www.alfresco.org/ws/model/content/1.0"/>
|
||||||
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
||||||
</operation>
|
</operation>
|
||||||
<operation name="getClassPermissions" qname="operNS:getClassPermissions" xmlns:operNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnQName="retNS:result" xmlns:retNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnType="rtns:GetPermissionsResult" xmlns:rtns="http://www.alfresco.org/ws/service/accesscontrol/1.0" soapAction="http://www.alfresco.org/ws/service/accesscontrol/1.0/getClassPermissions" >
|
<operation name="getClassPermissions" qname="operNS:getClassPermissions" xmlns:operNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnQName="retNS:result" xmlns:retNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnType="rtns:GetClassPermissionsResult" xmlns:rtns="http://www.alfresco.org/ws/service/accesscontrol/1.0" soapAction="http://www.alfresco.org/ws/service/accesscontrol/1.0/getClassPermissions" >
|
||||||
<parameter qname="pns:classNames" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
|
<parameter qname="pns:classNames" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
|
||||||
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
||||||
</operation>
|
</operation>
|
||||||
@@ -216,6 +216,14 @@
|
|||||||
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
|
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
|
||||||
encodingStyle=""
|
encodingStyle=""
|
||||||
/>
|
/>
|
||||||
|
<typeMapping
|
||||||
|
xmlns:ns="http://www.alfresco.org/ws/service/accesscontrol/1.0"
|
||||||
|
qname="ns:AccessStatus"
|
||||||
|
type="java:org.alfresco.repo.webservice.accesscontrol.AccessStatus"
|
||||||
|
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
|
||||||
|
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
|
||||||
|
encodingStyle=""
|
||||||
|
/>
|
||||||
<typeMapping
|
<typeMapping
|
||||||
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
||||||
qname="ns:>ContentFormat>mimetype"
|
qname="ns:>ContentFormat>mimetype"
|
||||||
@@ -224,14 +232,6 @@
|
|||||||
deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
|
deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
|
||||||
encodingStyle=""
|
encodingStyle=""
|
||||||
/>
|
/>
|
||||||
<typeMapping
|
|
||||||
xmlns:ns="http://www.alfresco.org/ws/service/accesscontrol/1.0"
|
|
||||||
qname="ns:AccessState"
|
|
||||||
type="java:org.alfresco.repo.webservice.accesscontrol.AccessState"
|
|
||||||
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
|
|
||||||
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
|
|
||||||
encodingStyle=""
|
|
||||||
/>
|
|
||||||
<typeMapping
|
<typeMapping
|
||||||
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
||||||
qname="ns:Query"
|
qname="ns:Query"
|
||||||
|
@@ -1,72 +1,623 @@
|
|||||||
package org.alfresco.repo.webservice.accesscontrol;
|
package org.alfresco.repo.webservice.accesscontrol;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.repo.transaction.TransactionComponent;
|
import org.alfresco.repo.transaction.TransactionComponent;
|
||||||
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
|
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||||
import org.alfresco.repo.webservice.AbstractWebService;
|
import org.alfresco.repo.webservice.AbstractWebService;
|
||||||
|
import org.alfresco.repo.webservice.Utils;
|
||||||
|
import org.alfresco.repo.webservice.action.ActionFault;
|
||||||
import org.alfresco.repo.webservice.types.Predicate;
|
import org.alfresco.repo.webservice.types.Predicate;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
public class AccessControlWebService extends AbstractWebService implements AccessControlServiceSoapPort
|
public class AccessControlWebService extends AbstractWebService implements AccessControlServiceSoapPort
|
||||||
{
|
{
|
||||||
|
/** Log */
|
||||||
|
private static Log logger = LogFactory.getLog(AccessControlWebService.class);
|
||||||
|
|
||||||
|
/** Transaction service */
|
||||||
private TransactionComponent transactionService = null;
|
private TransactionComponent transactionService = null;
|
||||||
|
|
||||||
|
/** Permission service */
|
||||||
|
private PermissionService permissionService = null;
|
||||||
|
|
||||||
|
/** Ownable service */
|
||||||
|
private OwnableService ownableService = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the transaction service
|
||||||
|
*
|
||||||
|
* @param transactionService the transaction service
|
||||||
|
*/
|
||||||
public void setTransactionService(TransactionComponent transactionService)
|
public void setTransactionService(TransactionComponent transactionService)
|
||||||
{
|
{
|
||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL[] getACLs(Predicate predicate, ACE filter) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Set the permissions service
|
||||||
|
*
|
||||||
|
* @param permissionService the permissions service
|
||||||
|
*/
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
this.permissionService = permissionService;
|
||||||
return null;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the ownable service
|
||||||
|
*
|
||||||
|
* @param ownableService the ownable service
|
||||||
|
*/
|
||||||
|
public void setOwnableService(OwnableService ownableService)
|
||||||
|
{
|
||||||
|
this.ownableService = ownableService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#getACLs(org.alfresco.repo.webservice.types.Predicate, org.alfresco.repo.webservice.accesscontrol.ACE)
|
||||||
|
*/
|
||||||
|
public ACL[] getACLs(final Predicate predicate, final ACE filter) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ACL[]>()
|
||||||
|
{
|
||||||
|
public ACL[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getACLsImpl(predicate, filter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL[] addACEs(Predicate predicate, ACE[] aces) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Get the ACL's for the predicate, filtered if appropraite.
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param filter the fileter (optional)
|
||||||
|
* @return an array of ACL's
|
||||||
|
*/
|
||||||
|
private ACL[] getACLsImpl(Predicate predicate, ACE filter)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// Resolve the nodes
|
||||||
return null;
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
ACL[] acls = new ACL[nodes.size()];
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Create ACL of node
|
||||||
|
ACL acl = getACLFromNodeRef(node, filter);
|
||||||
|
|
||||||
|
// Add the acl to the results
|
||||||
|
acls[index] = acl;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL[] removeACEs(Predicate predicate, ACE[] aces) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Given a node reference, creates the relating ACL
|
||||||
|
*
|
||||||
|
* @param node the node reference
|
||||||
|
* @return the ACL
|
||||||
|
*/
|
||||||
|
private ACL getACLFromNodeRef(NodeRef node, ACE filter)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// Create the acl
|
||||||
return null;
|
ACL acl = new ACL();
|
||||||
|
acl.setReference(Utils.convertToReference(node));
|
||||||
|
|
||||||
|
// Set the inhertied value
|
||||||
|
boolean inheritPermission = this.permissionService.getInheritParentPermissions(node);
|
||||||
|
acl.setInheritPermissions(inheritPermission);
|
||||||
|
|
||||||
|
// Get the access permissions
|
||||||
|
Set<AccessPermission> accessPermissions = this.permissionService.getAllSetPermissions(node);
|
||||||
|
ACE[] aces = new ACE[accessPermissions.size()];
|
||||||
|
|
||||||
|
// Marshal the permissions into ACE's
|
||||||
|
int count = 0;
|
||||||
|
for (AccessPermission permission : accessPermissions)
|
||||||
|
{
|
||||||
|
// TODO need to filter the results accordingly using ACE filter
|
||||||
|
|
||||||
|
// Create the ace
|
||||||
|
org.alfresco.repo.webservice.accesscontrol.AccessStatus accessStatus = org.alfresco.repo.webservice.accesscontrol.AccessStatus.declined;
|
||||||
|
if (AccessStatus.ALLOWED.equals(permission.getAccessStatus()) == true)
|
||||||
|
{
|
||||||
|
accessStatus = org.alfresco.repo.webservice.accesscontrol.AccessStatus.acepted;
|
||||||
|
}
|
||||||
|
ACE ace = new ACE(permission.getAuthority(),permission.getPermission(), accessStatus);
|
||||||
|
|
||||||
|
// Add ace to array
|
||||||
|
aces[count] = ace;
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
acl.setAces(aces);
|
||||||
|
return acl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetPermissionsResult[] getPermissions(Predicate predicate) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#addACEs(org.alfresco.repo.webservice.types.Predicate, org.alfresco.repo.webservice.accesscontrol.ACE[])
|
||||||
|
*/
|
||||||
|
public ACL[] addACEs(final Predicate predicate, final ACE[] aces) throws RemoteException, AccessControlFault
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ACL[]>()
|
||||||
|
{
|
||||||
|
public ACL[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return addACEsImpl(predicate, aces);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetPermissionsResult[] getClassPermissions(String[] classNames) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Add ACE to a collection of nodes
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param aces the ACE's to add
|
||||||
|
* @return the ACL's of the modified node
|
||||||
|
*/
|
||||||
|
private ACL[] addACEsImpl(Predicate predicate, ACE[] aces)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// Resolce the predicate
|
||||||
return null;
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
ACL[] acls = new ACL[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Add the permissions for each ace
|
||||||
|
for (ACE ace : aces)
|
||||||
|
{
|
||||||
|
// Add the permissions associated with the ace
|
||||||
|
boolean allow = false;
|
||||||
|
if (ace.getAccessStatus().equals(org.alfresco.repo.webservice.accesscontrol.AccessStatus.acepted) == true)
|
||||||
|
{
|
||||||
|
allow = true;
|
||||||
|
}
|
||||||
|
this.permissionService.setPermission(node, ace.getAuthority(), ace.getPermission(), allow);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the ACL forthis node to the returned array
|
||||||
|
acls[count] = getACLFromNodeRef(node, null);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HasPermissionsResult hasPermissions(Predicate predicate, String[] permissions) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#removeACEs(org.alfresco.repo.webservice.types.Predicate, org.alfresco.repo.webservice.accesscontrol.ACE[])
|
||||||
|
*/
|
||||||
|
public ACL[] removeACEs(final Predicate predicate, final ACE[] aces) throws RemoteException, AccessControlFault
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ACL[]>()
|
||||||
|
{
|
||||||
|
public ACL[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return removeACEsImpl(predicate, aces);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL[] setInheritPermission(Predicate predicate, boolean inheritPermission) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Remove specified ACE's from the nodes. Removes all permissions if no ACE's specified.
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param aces the ACE's to remove
|
||||||
|
* @return the modified ACL's
|
||||||
|
*/
|
||||||
|
private ACL[] removeACEsImpl(Predicate predicate, ACE[] aces)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// Resolce the predicate
|
||||||
return null;
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
ACL[] acls = new ACL[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
if (aces == null)
|
||||||
|
{
|
||||||
|
// Delete all the permissions
|
||||||
|
this.permissionService.deletePermissions(node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Delete the permissions for each ACE
|
||||||
|
for (ACE ace : aces)
|
||||||
|
{
|
||||||
|
boolean allow = false;
|
||||||
|
if (ace.getAccessStatus().equals(org.alfresco.repo.webservice.accesscontrol.AccessStatus.acepted) == true)
|
||||||
|
{
|
||||||
|
allow = true;
|
||||||
|
}
|
||||||
|
this.permissionService.deletePermission(node, ace.getAuthority(), ace.getPermission(), allow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the ACL forthis node to the returned array
|
||||||
|
acls[count] = getACLFromNodeRef(node, null);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnerResult[] getOwners(Predicate predicate) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#getPermissions(org.alfresco.repo.webservice.types.Predicate)
|
||||||
|
*/
|
||||||
|
public GetPermissionsResult[] getPermissions(final Predicate predicate) throws RemoteException, AccessControlFault
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<GetPermissionsResult[]>()
|
||||||
|
{
|
||||||
|
public GetPermissionsResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getPermissionsImpl(predicate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnerResult[] setOwners(Predicate predicate, String owner) throws RemoteException, AccessControlFault
|
/**
|
||||||
|
* Get the permissions
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @return the permissions available
|
||||||
|
*/
|
||||||
|
private GetPermissionsResult[] getPermissionsImpl(Predicate predicate)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// Resolve the predicate
|
||||||
return null;
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
GetPermissionsResult[] results = new GetPermissionsResult[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Get the permissions
|
||||||
|
Set<String> permissions = this.permissionService.getSettablePermissions(node);
|
||||||
|
|
||||||
|
// Create the permissions result object
|
||||||
|
GetPermissionsResult result = new GetPermissionsResult();
|
||||||
|
result.setReference(Utils.convertToReference(node));
|
||||||
|
result.setPermissions((String[])permissions.toArray(new String[permissions.size()]));
|
||||||
|
|
||||||
|
// Add result to array
|
||||||
|
results[count] = result;
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#getClassPermissions(java.lang.String[])
|
||||||
|
*/
|
||||||
|
public GetClassPermissionsResult[] getClassPermissions(final String[] classNames) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<GetClassPermissionsResult[]>()
|
||||||
|
{
|
||||||
|
public GetClassPermissionsResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getClassPermissionsImpl(classNames);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the permissions based on type
|
||||||
|
*
|
||||||
|
* @param classNames the class names
|
||||||
|
* @return the permission results
|
||||||
|
*/
|
||||||
|
private GetClassPermissionsResult[] getClassPermissionsImpl(String[] classNames)
|
||||||
|
{
|
||||||
|
// Resolve the predicate
|
||||||
|
GetClassPermissionsResult[] results = new GetClassPermissionsResult[classNames.length];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (String className : classNames)
|
||||||
|
{
|
||||||
|
// Get the permissions
|
||||||
|
Set<String> permissions = this.permissionService.getSettablePermissions(QName.createQName(className));
|
||||||
|
|
||||||
|
// Create the permissions result object
|
||||||
|
GetClassPermissionsResult result = new GetClassPermissionsResult();
|
||||||
|
result.setClassName(className);
|
||||||
|
result.setPermissions((String[])permissions.toArray(new String[permissions.size()]));
|
||||||
|
|
||||||
|
// Add result to array
|
||||||
|
results[count] = result;
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#hasPermissions(org.alfresco.repo.webservice.types.Predicate, java.lang.String[])
|
||||||
|
*/
|
||||||
|
public HasPermissionsResult[] hasPermissions(final Predicate predicate, final String[] permissions) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<HasPermissionsResult[]>()
|
||||||
|
{
|
||||||
|
public HasPermissionsResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return hasPermissionsImpl(predicate, permissions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether a set of node has a given set of permissions.
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param permissions the permissions
|
||||||
|
* @return the permissions result
|
||||||
|
*/
|
||||||
|
private HasPermissionsResult[] hasPermissionsImpl(Predicate predicate, String[] permissions)
|
||||||
|
{
|
||||||
|
// Resolve the predicate
|
||||||
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
List<HasPermissionsResult> results = new ArrayList<HasPermissionsResult>(20);
|
||||||
|
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
for (String permission : permissions)
|
||||||
|
{
|
||||||
|
// Detemine whether the node has the permissions
|
||||||
|
AccessStatus accessStatus = this.permissionService.hasPermission(node, permission);
|
||||||
|
org.alfresco.repo.webservice.accesscontrol.AccessStatus accessState = org.alfresco.repo.webservice.accesscontrol.AccessStatus.declined;
|
||||||
|
if (AccessStatus.ALLOWED.equals(accessStatus) == true)
|
||||||
|
{
|
||||||
|
accessState = org.alfresco.repo.webservice.accesscontrol.AccessStatus.acepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the results list
|
||||||
|
results.add(new HasPermissionsResult(Utils.convertToReference(node), permission, accessState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (HasPermissionsResult[])results.toArray(new HasPermissionsResult[results.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#setInheritPermission(org.alfresco.repo.webservice.types.Predicate, boolean)
|
||||||
|
*/
|
||||||
|
public ACL[] setInheritPermission(final Predicate predicate, final boolean inheritPermission) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ACL[]>()
|
||||||
|
{
|
||||||
|
public ACL[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return setInheritPermissionImpl(predicate, inheritPermission);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the inherit permissions flag
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param inheritPermission indicates whether the permissions are inherited or not
|
||||||
|
* @return the updated acl's
|
||||||
|
*/
|
||||||
|
private ACL[] setInheritPermissionImpl(Predicate predicate, boolean inheritPermission)
|
||||||
|
{
|
||||||
|
// Resolve the predicate
|
||||||
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
ACL[] acls = new ACL[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Set the inherited permission value
|
||||||
|
this.permissionService.setInheritParentPermissions(node, inheritPermission);
|
||||||
|
|
||||||
|
// Add the ACL of the modified node to the result
|
||||||
|
acls[count] = getACLFromNodeRef(node, null);
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acls;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#getOwners(org.alfresco.repo.webservice.types.Predicate)
|
||||||
|
*/
|
||||||
|
public OwnerResult[] getOwners(final Predicate predicate) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<OwnerResult[]>()
|
||||||
|
{
|
||||||
|
public OwnerResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getOwnersImpl(predicate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the owners of the nodes
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @return the owner details
|
||||||
|
*/
|
||||||
|
private OwnerResult[] getOwnersImpl(Predicate predicate)
|
||||||
|
{
|
||||||
|
// Convert predicate
|
||||||
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
OwnerResult[] result = new OwnerResult[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Get the current owner of the node
|
||||||
|
String owner = this.ownableService.getOwner(node);
|
||||||
|
|
||||||
|
// Marshal into result
|
||||||
|
result[count] = new OwnerResult(Utils.convertToReference(node), owner);
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.webservice.accesscontrol.AccessControlServiceSoapPort#setOwners(org.alfresco.repo.webservice.types.Predicate, java.lang.String)
|
||||||
|
*/
|
||||||
|
public OwnerResult[] setOwners(final Predicate predicate, final String owner) throws RemoteException, AccessControlFault
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<OwnerResult[]>()
|
||||||
|
{
|
||||||
|
public OwnerResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return setOwnersImpl(predicate, owner);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the owner of a nodes
|
||||||
|
*
|
||||||
|
* @param predicate the predicate
|
||||||
|
* @param owner the owner
|
||||||
|
* @return the owner results updated
|
||||||
|
*/
|
||||||
|
private OwnerResult[] setOwnersImpl(Predicate predicate, String owner)
|
||||||
|
{
|
||||||
|
// Convert predicate
|
||||||
|
List<NodeRef> nodes = Utils.resolvePredicate(predicate, this.nodeService, this.searchService, this.namespaceService);
|
||||||
|
OwnerResult[] result = new OwnerResult[nodes.size()];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (NodeRef node : nodes)
|
||||||
|
{
|
||||||
|
// Set the owner of the node
|
||||||
|
this.ownableService.setOwner(node, owner);
|
||||||
|
|
||||||
|
// Marshal into result
|
||||||
|
result[count] = new OwnerResult(Utils.convertToReference(node), owner);
|
||||||
|
count ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,8 @@ import org.alfresco.service.cmr.rule.Rule;
|
|||||||
import org.alfresco.service.cmr.rule.RuleService;
|
import org.alfresco.service.cmr.rule.RuleService;
|
||||||
import org.alfresco.service.cmr.rule.RuleType;
|
import org.alfresco.service.cmr.rule.RuleType;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action web service implementation
|
* Action web service implementation
|
||||||
@@ -60,6 +62,9 @@ import org.alfresco.util.GUID;
|
|||||||
*/
|
*/
|
||||||
public class ActionWebService extends AbstractWebService implements ActionServiceSoapPort
|
public class ActionWebService extends AbstractWebService implements ActionServiceSoapPort
|
||||||
{
|
{
|
||||||
|
/** Log */
|
||||||
|
private static Log logger = LogFactory.getLog(ActionWebService.class);
|
||||||
|
|
||||||
/** The action service */
|
/** The action service */
|
||||||
private ActionService actionService;
|
private ActionService actionService;
|
||||||
|
|
||||||
@@ -118,13 +123,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public ActionItemDefinition[] getConditionDefinitions() throws RemoteException,
|
public ActionItemDefinition[] getConditionDefinitions() throws RemoteException,
|
||||||
ActionFault
|
ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition[]>()
|
try
|
||||||
{
|
{
|
||||||
public ActionItemDefinition[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition[]>()
|
||||||
{
|
{
|
||||||
return getConditionDefintionsImpl();
|
public ActionItemDefinition[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getConditionDefintionsImpl();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,13 +172,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public ActionItemDefinition[] getActionDefinitions() throws RemoteException,
|
public ActionItemDefinition[] getActionDefinitions() throws RemoteException,
|
||||||
ActionFault
|
ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition[]>()
|
try
|
||||||
{
|
{
|
||||||
public ActionItemDefinition[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition[]>()
|
||||||
{
|
{
|
||||||
return getActionDefinitionsImpl();
|
public ActionItemDefinition[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getActionDefinitionsImpl();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,13 +220,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
*/
|
*/
|
||||||
public ActionItemDefinition getActionItemDefinition(final String name, final ActionItemDefinitionType definitionType) throws RemoteException, ActionFault
|
public ActionItemDefinition getActionItemDefinition(final String name, final ActionItemDefinitionType definitionType) throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition>()
|
try
|
||||||
{
|
{
|
||||||
public ActionItemDefinition doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionItemDefinition>()
|
||||||
{
|
{
|
||||||
return getActionItemDefinitionImpl(name, definitionType);
|
public ActionItemDefinition doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getActionItemDefinitionImpl(name, definitionType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -273,13 +314,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.action.RuleType[] getRuleTypes() throws RemoteException, ActionFault
|
public org.alfresco.repo.webservice.action.RuleType[] getRuleTypes() throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.RuleType[]>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.RuleType[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.RuleType[]>()
|
||||||
{
|
{
|
||||||
return getRuleTypesImpl();
|
public org.alfresco.repo.webservice.action.RuleType[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getRuleTypesImpl();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.alfresco.repo.webservice.action.RuleType[] getRuleTypesImpl() throws RemoteException, ActionFault
|
public org.alfresco.repo.webservice.action.RuleType[] getRuleTypesImpl() throws RemoteException, ActionFault
|
||||||
@@ -307,13 +360,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.action.RuleType getRuleType(final String name) throws RemoteException, ActionFault
|
public org.alfresco.repo.webservice.action.RuleType getRuleType(final String name) throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.RuleType>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.RuleType doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.RuleType>()
|
||||||
{
|
{
|
||||||
return getRuleTypeImpl(name);
|
public org.alfresco.repo.webservice.action.RuleType doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getRuleTypeImpl(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.alfresco.repo.webservice.action.RuleType getRuleTypeImpl(String name) throws RemoteException, ActionFault
|
public org.alfresco.repo.webservice.action.RuleType getRuleTypeImpl(String name) throws RemoteException, ActionFault
|
||||||
@@ -334,13 +399,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
*/
|
*/
|
||||||
public org.alfresco.repo.webservice.action.Action[] getActions(final Reference reference, final ActionFilter filter) throws RemoteException, ActionFault
|
public org.alfresco.repo.webservice.action.Action[] getActions(final Reference reference, final ActionFilter filter) throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Action[]>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.Action[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Action[]>()
|
||||||
{
|
{
|
||||||
return getActionsImpl(reference, filter);
|
public org.alfresco.repo.webservice.action.Action[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getActionsImpl(reference, filter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.alfresco.repo.webservice.action.Action[] getActionsImpl(Reference reference, ActionFilter filter) throws RemoteException, ActionFault
|
private org.alfresco.repo.webservice.action.Action[] getActionsImpl(Reference reference, ActionFilter filter) throws RemoteException, ActionFault
|
||||||
@@ -486,15 +563,35 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
final Reference reference,
|
final Reference reference,
|
||||||
final org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
final org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Action[]>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.Action[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Action[]>()
|
||||||
{
|
{
|
||||||
return saveActionsImpl(reference, webServiceActions);
|
public org.alfresco.repo.webservice.action.Action[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return saveActionsImpl(reference, webServiceActions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reference
|
||||||
|
* @param webServiceActions
|
||||||
|
* @return
|
||||||
|
* @throws RemoteException
|
||||||
|
* @throws ActionFault
|
||||||
|
*/
|
||||||
private org.alfresco.repo.webservice.action.Action[] saveActionsImpl(
|
private org.alfresco.repo.webservice.action.Action[] saveActionsImpl(
|
||||||
Reference reference,
|
Reference reference,
|
||||||
org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
||||||
@@ -688,14 +785,26 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public void removeActions(final Reference reference, final org.alfresco.repo.webservice.action.Action[] webServiceActions)
|
public void removeActions(final Reference reference, final org.alfresco.repo.webservice.action.Action[] webServiceActions)
|
||||||
throws RemoteException, ActionFault
|
throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
try
|
||||||
{
|
{
|
||||||
public Object doWork() throws Exception
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
||||||
{
|
{
|
||||||
removeActionsImpl(reference, webServiceActions);
|
public Object doWork() throws Exception
|
||||||
return null;
|
{
|
||||||
|
removeActionsImpl(reference, webServiceActions);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeActionsImpl(Reference reference, org.alfresco.repo.webservice.action.Action[] webServiceActions)
|
private void removeActionsImpl(Reference reference, org.alfresco.repo.webservice.action.Action[] webServiceActions)
|
||||||
@@ -724,13 +833,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
*/
|
*/
|
||||||
public ActionExecutionResult[] executeActions(final Predicate predicate, final org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
public ActionExecutionResult[] executeActions(final Predicate predicate, final org.alfresco.repo.webservice.action.Action[] webServiceActions) throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionExecutionResult[]>()
|
try
|
||||||
{
|
{
|
||||||
public ActionExecutionResult[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<ActionExecutionResult[]>()
|
||||||
{
|
{
|
||||||
return executeActionsImpl(predicate, webServiceActions);
|
public ActionExecutionResult[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return executeActionsImpl(predicate, webServiceActions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -786,13 +907,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public org.alfresco.repo.webservice.action.Rule[] getRules(final Reference reference, final RuleFilter ruleFilter)
|
public org.alfresco.repo.webservice.action.Rule[] getRules(final Reference reference, final RuleFilter ruleFilter)
|
||||||
throws RemoteException, ActionFault
|
throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Rule[]>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.Rule[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Rule[]>()
|
||||||
{
|
{
|
||||||
return getRulesImpl(reference, ruleFilter);
|
public org.alfresco.repo.webservice.action.Rule[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getRulesImpl(reference, ruleFilter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.alfresco.repo.webservice.action.Rule[] getRulesImpl(Reference reference, RuleFilter ruleFilter)
|
private org.alfresco.repo.webservice.action.Rule[] getRulesImpl(Reference reference, RuleFilter ruleFilter)
|
||||||
@@ -876,13 +1009,25 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public org.alfresco.repo.webservice.action.Rule[] saveRules(final Reference reference, final org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
public org.alfresco.repo.webservice.action.Rule[] saveRules(final Reference reference, final org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
||||||
throws RemoteException, ActionFault
|
throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Rule[]>()
|
try
|
||||||
{
|
{
|
||||||
public org.alfresco.repo.webservice.action.Rule[] doWork() throws Exception
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<org.alfresco.repo.webservice.action.Rule[]>()
|
||||||
{
|
{
|
||||||
return saveRulesImpl(reference, webServiceRules);
|
public org.alfresco.repo.webservice.action.Rule[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return saveRulesImpl(reference, webServiceRules);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.alfresco.repo.webservice.action.Rule[] saveRulesImpl(Reference reference, org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
private org.alfresco.repo.webservice.action.Rule[] saveRulesImpl(Reference reference, org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
||||||
@@ -917,16 +1062,35 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
public void removeRules(final Reference reference, final org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
public void removeRules(final Reference reference, final org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
||||||
throws RemoteException, ActionFault
|
throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
try
|
||||||
{
|
{
|
||||||
public Object doWork() throws Exception
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
||||||
{
|
{
|
||||||
removeRulesImpl(reference, webServiceRules);
|
public Object doWork() throws Exception
|
||||||
return null;
|
{
|
||||||
|
removeRulesImpl(reference, webServiceRules);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reference
|
||||||
|
* @param webServiceRules
|
||||||
|
* @throws RemoteException
|
||||||
|
* @throws ActionFault
|
||||||
|
*/
|
||||||
public void removeRulesImpl(Reference reference, org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
public void removeRulesImpl(Reference reference, org.alfresco.repo.webservice.action.Rule[] webServiceRules)
|
||||||
throws RemoteException, ActionFault
|
throws RemoteException, ActionFault
|
||||||
{
|
{
|
||||||
@@ -949,6 +1113,11 @@ public class ActionWebService extends AbstractWebService implements ActionServic
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param webServiceRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private Rule convertToRule(org.alfresco.repo.webservice.action.Rule webServiceRule)
|
private Rule convertToRule(org.alfresco.repo.webservice.action.Rule webServiceRule)
|
||||||
{
|
{
|
||||||
// If the id is null then generate one
|
// If the id is null then generate one
|
||||||
|
@@ -16,10 +16,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.webservice.administration;
|
package org.alfresco.repo.webservice.administration;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.transaction.TransactionComponent;
|
import org.alfresco.repo.transaction.TransactionComponent;
|
||||||
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
|
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||||
import org.alfresco.repo.webservice.AbstractWebService;
|
import org.alfresco.repo.webservice.AbstractWebService;
|
||||||
|
import org.alfresco.repo.webservice.action.ActionFault;
|
||||||
|
import org.alfresco.repo.webservice.types.NamedValue;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||||
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
@@ -27,13 +47,62 @@ import org.alfresco.repo.webservice.AbstractWebService;
|
|||||||
public class AdministrationWebService extends AbstractWebService implements
|
public class AdministrationWebService extends AbstractWebService implements
|
||||||
AdministrationServiceSoapPort
|
AdministrationServiceSoapPort
|
||||||
{
|
{
|
||||||
|
/** Log */
|
||||||
|
private static Log logger = LogFactory.getLog(AdministrationWebService.class);
|
||||||
|
|
||||||
|
/** The person service */
|
||||||
|
private PersonService personService = null;
|
||||||
|
|
||||||
|
/** The authentication service */
|
||||||
|
private AuthenticationService authenticationService = null;
|
||||||
|
|
||||||
|
/** The transaction service */
|
||||||
private TransactionComponent transactionService = null;
|
private TransactionComponent transactionService = null;
|
||||||
|
|
||||||
|
/** A set of ignored properties */
|
||||||
|
private static Set<QName> ignoredProperties = new HashSet<QName>(3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public AdministrationWebService()
|
||||||
|
{
|
||||||
|
// Set properties to ignore
|
||||||
|
AdministrationWebService.ignoredProperties.add(ContentModel.PROP_STORE_PROTOCOL);
|
||||||
|
AdministrationWebService.ignoredProperties.add(ContentModel.PROP_STORE_IDENTIFIER);
|
||||||
|
AdministrationWebService.ignoredProperties.add(ContentModel.PROP_NODE_UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the transaction service
|
||||||
|
*
|
||||||
|
* @param transactionService the transaction service
|
||||||
|
*/
|
||||||
public void setTransactionService(TransactionComponent transactionService)
|
public void setTransactionService(TransactionComponent transactionService)
|
||||||
{
|
{
|
||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the person service
|
||||||
|
*
|
||||||
|
* @param personService sets the person service
|
||||||
|
*/
|
||||||
|
public void setPersonService(PersonService personService)
|
||||||
|
{
|
||||||
|
this.personService = personService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the authentication service
|
||||||
|
*
|
||||||
|
* @param authenticationService the authentication service
|
||||||
|
*/
|
||||||
|
public void setAuthenticationService(AuthenticationService authenticationService)
|
||||||
|
{
|
||||||
|
this.authenticationService = authenticationService;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#queryUsers(org.alfresco.repo.webservice.administration.UserFilter)
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#queryUsers(org.alfresco.repo.webservice.administration.UserFilter)
|
||||||
*/
|
*/
|
||||||
@@ -54,54 +123,294 @@ public class AdministrationWebService extends AbstractWebService implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#getUser(java.lang.String)
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#getUser(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public UserDetails getUser(String userName) throws RemoteException,
|
public UserDetails getUser(final String userName) throws RemoteException, AdministrationFault
|
||||||
AdministrationFault
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<UserDetails>()
|
||||||
|
{
|
||||||
|
public UserDetails doWork() throws Exception
|
||||||
|
{
|
||||||
|
return getUserImpl(userName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user details
|
||||||
|
*
|
||||||
|
* @param userName the user name
|
||||||
|
* @return the user details object
|
||||||
|
* @throws RemoteException
|
||||||
|
* @throws AdministrationFault
|
||||||
|
*/
|
||||||
|
private UserDetails getUserImpl(String userName)
|
||||||
|
{
|
||||||
|
UserDetails userDetails = null;
|
||||||
|
|
||||||
|
if (this.personService.personExists(userName) == true)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = this.personService.getPerson(userName);
|
||||||
|
userDetails = createUserDetails(userName, nodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Throw an exception to indicate that the user does not exist
|
||||||
|
throw new RuntimeException(MessageFormat.format("The user with name {0} does not exist.", new Object[]{userName}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return userDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
|
* Given a valid person node reference will create a user details object
|
||||||
|
*
|
||||||
|
* @param nodeRef the node reference
|
||||||
|
* @return the user details object populated with the appropriate property values
|
||||||
|
*/
|
||||||
|
private UserDetails createUserDetails(String userName, NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
// Create the user details object
|
||||||
|
UserDetails userDetails = new UserDetails();
|
||||||
|
|
||||||
|
// Set the user name
|
||||||
|
userDetails.setUserName(userName);
|
||||||
|
|
||||||
|
// Set the various property values
|
||||||
|
Map<QName, Serializable> properties = this.nodeService.getProperties(nodeRef);
|
||||||
|
List<NamedValue> namedValues = new ArrayList<NamedValue>(properties.size());
|
||||||
|
for (Map.Entry<QName, Serializable> entry : properties.entrySet())
|
||||||
|
{
|
||||||
|
if (AdministrationWebService.ignoredProperties.contains(entry.getKey()) == false)
|
||||||
|
{
|
||||||
|
String value = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
value = DefaultTypeConverter.INSTANCE.convert(String.class, entry.getValue());
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
value = entry.getValue().toString();
|
||||||
|
}
|
||||||
|
namedValues.add(new NamedValue(entry.getKey().toString(), value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userDetails.setProperties((NamedValue[])namedValues.toArray(new NamedValue[namedValues.size()]));
|
||||||
|
|
||||||
|
return userDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#createUsers(org.alfresco.repo.webservice.administration.NewUserDetails[])
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#createUsers(org.alfresco.repo.webservice.administration.NewUserDetails[])
|
||||||
*/
|
*/
|
||||||
public UserDetails[] createUsers(NewUserDetails[] newUsers)
|
public UserDetails[] createUsers(final NewUserDetails[] newUsers) throws RemoteException, AdministrationFault
|
||||||
throws RemoteException, AdministrationFault
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<UserDetails[]>()
|
||||||
|
{
|
||||||
|
public UserDetails[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return createUsersImpl(newUsers);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the new users
|
||||||
|
*
|
||||||
|
* @param newUsers the new users detail
|
||||||
|
* @return the details of the created users
|
||||||
|
* @throws RemoteException
|
||||||
|
* @throws AdministrationFault
|
||||||
|
*/
|
||||||
|
private UserDetails[] createUsersImpl(NewUserDetails[] newUsers)
|
||||||
|
{
|
||||||
|
UserDetails[] userDetails = new UserDetails[newUsers.length];
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (NewUserDetails newUser : newUsers)
|
||||||
|
{
|
||||||
|
// Create a new authentication
|
||||||
|
this.authenticationService.createAuthentication(newUser.getUserName(), newUser.getPassword().toCharArray());
|
||||||
|
|
||||||
|
// Create a new person
|
||||||
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(7);
|
||||||
|
properties.put(ContentModel.PROP_USERNAME, newUser.getUserName());
|
||||||
|
for (NamedValue namedValue : newUser.getProperties())
|
||||||
|
{
|
||||||
|
properties.put(QName.createQName(namedValue.getName()), namedValue.getValue());
|
||||||
|
}
|
||||||
|
NodeRef personNodeRef = this.personService.createPerson(properties);
|
||||||
|
|
||||||
|
// Add the details to the result
|
||||||
|
userDetails[index] = createUserDetails(newUser.getUserName(), personNodeRef);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return userDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#updateUsers(org.alfresco.repo.webservice.administration.UserDetails[])
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#updateUsers(org.alfresco.repo.webservice.administration.UserDetails[])
|
||||||
*/
|
*/
|
||||||
public UserDetails[] updateUsers(UserDetails[] users)
|
public UserDetails[] updateUsers(final UserDetails[] users) throws RemoteException, AdministrationFault
|
||||||
throws RemoteException, AdministrationFault
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
return null;
|
{
|
||||||
|
return TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<UserDetails[]>()
|
||||||
|
{
|
||||||
|
public UserDetails[] doWork() throws Exception
|
||||||
|
{
|
||||||
|
return updateUsersImpl(users);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the users details
|
||||||
|
*
|
||||||
|
* @param users the user details to update
|
||||||
|
* @return the updated user details
|
||||||
|
*/
|
||||||
|
private UserDetails[] updateUsersImpl(UserDetails[] users)
|
||||||
|
{
|
||||||
|
UserDetails[] userDetails = new UserDetails[users.length];
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (UserDetails user : users)
|
||||||
|
{
|
||||||
|
// Build the property map
|
||||||
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(7);
|
||||||
|
properties.put(ContentModel.PROP_USERNAME, user.getUserName());
|
||||||
|
for (NamedValue namedValue : user.getProperties())
|
||||||
|
{
|
||||||
|
properties.put(QName.createQName(namedValue.getName()), namedValue.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the properties of the person
|
||||||
|
this.personService.setPersonProperties(user.getUserName(), properties);
|
||||||
|
|
||||||
|
// Add the details to the result
|
||||||
|
NodeRef nodeRef = this.personService.getPerson(user.getUserName());
|
||||||
|
userDetails[index] = createUserDetails(user.getUserName(), nodeRef);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return userDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#changePassword(java.lang.String, java.lang.String, java.lang.String)
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#changePassword(java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void changePassword(String userName, String oldPassword,
|
public void changePassword(final String userName, final String oldPassword, final String newPassword) throws RemoteException, AdministrationFault
|
||||||
String newPassword) throws RemoteException, AdministrationFault
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
|
{
|
||||||
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
changePasswordImpl(userName, oldPassword, newPassword);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
|
* Change the current password of the user
|
||||||
|
*
|
||||||
|
* @param userName the user name
|
||||||
|
* @param oldPassword the old (current) password
|
||||||
|
* @param newPassword the new password
|
||||||
|
*/
|
||||||
|
private void changePasswordImpl(String userName, String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
// Update the authentication details
|
||||||
|
this.authenticationService.updateAuthentication(userName, oldPassword.toCharArray(), newPassword.toCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#deleteUsers(java.lang.String[])
|
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#deleteUsers(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
public void deleteUsers(String[] userNames) throws RemoteException,
|
public void deleteUsers(final String[] userNames) throws RemoteException,
|
||||||
AdministrationFault
|
AdministrationFault
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
try
|
||||||
|
{
|
||||||
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
deleteUsersImpl(userNames);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Throwable exception)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.error("Unexpected error occurred", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ActionFault(0, exception.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete users
|
||||||
|
*
|
||||||
|
* @param userNames the names of the users to delete
|
||||||
|
*/
|
||||||
|
private void deleteUsersImpl(String[] userNames)
|
||||||
|
{
|
||||||
|
for (String userName : userNames)
|
||||||
|
{
|
||||||
|
this.personService.deletePerson(userName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -85,6 +85,7 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
|
|||||||
{
|
{
|
||||||
if (ticket != null)
|
if (ticket != null)
|
||||||
{
|
{
|
||||||
|
this.authenticationService.validate(ticket);
|
||||||
this.authenticationService.invalidateTicket(ticket);
|
this.authenticationService.invalidateTicket(ticket);
|
||||||
this.authenticationService.clearCurrentSecurityContext();
|
this.authenticationService.clearCurrentSecurityContext();
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
throw new AuthenticationFault(0, e.getMessage());
|
throw new AuthenticationFault(0, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -175,6 +175,12 @@
|
|||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionComponent"/>
|
<ref bean="transactionComponent"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="permissionService">
|
||||||
|
<ref bean="PermissionService"/>
|
||||||
|
</property>
|
||||||
|
<property name="ownableService">
|
||||||
|
<ref bean="OwnableService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="administrationWebService" class="org.alfresco.repo.webservice.administration.AdministrationWebService">
|
<bean id="administrationWebService" class="org.alfresco.repo.webservice.administration.AdministrationWebService">
|
||||||
@@ -190,6 +196,12 @@
|
|||||||
<property name="transactionService">
|
<property name="transactionService">
|
||||||
<ref bean="transactionComponent"/>
|
<ref bean="transactionComponent"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="authenticationService">
|
||||||
|
<ref bean="AuthenticationService"/>
|
||||||
|
</property>
|
||||||
|
<property name="personService">
|
||||||
|
<ref bean="personService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -2358,7 +2358,7 @@
|
|||||||
<parameter qname="pns:predicate" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:Predicate" xmlns:tns="http://www.alfresco.org/ws/model/content/1.0"/>
|
<parameter qname="pns:predicate" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:Predicate" xmlns:tns="http://www.alfresco.org/ws/model/content/1.0"/>
|
||||||
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
||||||
</operation>
|
</operation>
|
||||||
<operation name="getClassPermissions" qname="operNS:getClassPermissions" xmlns:operNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnQName="retNS:result" xmlns:retNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnType="rtns:GetPermissionsResult" xmlns:rtns="http://www.alfresco.org/ws/service/accesscontrol/1.0" soapAction="http://www.alfresco.org/ws/service/accesscontrol/1.0/getClassPermissions" >
|
<operation name="getClassPermissions" qname="operNS:getClassPermissions" xmlns:operNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnQName="retNS:result" xmlns:retNS="http://www.alfresco.org/ws/service/accesscontrol/1.0" returnType="rtns:GetClassPermissionsResult" xmlns:rtns="http://www.alfresco.org/ws/service/accesscontrol/1.0" soapAction="http://www.alfresco.org/ws/service/accesscontrol/1.0/getClassPermissions" >
|
||||||
<parameter qname="pns:classNames" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
|
<parameter qname="pns:classNames" xmlns:pns="http://www.alfresco.org/ws/service/accesscontrol/1.0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
|
||||||
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
<fault name="AccessControlFault" qname="fns:AccessControlFault" xmlns:fns="http://www.alfresco.org/ws/service/accesscontrol/1.0" class="org.alfresco.repo.webservice.accesscontrol.AccessControlFault" type="tns:AccessControlFault" xmlns:tns="http://www.alfresco.org/ws/service/accesscontrol/1.0"/>
|
||||||
</operation>
|
</operation>
|
||||||
@@ -2535,6 +2535,14 @@
|
|||||||
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
|
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
|
||||||
encodingStyle=""
|
encodingStyle=""
|
||||||
/>
|
/>
|
||||||
|
<typeMapping
|
||||||
|
xmlns:ns="http://www.alfresco.org/ws/service/accesscontrol/1.0"
|
||||||
|
qname="ns:AccessStatus"
|
||||||
|
type="java:org.alfresco.repo.webservice.accesscontrol.AccessStatus"
|
||||||
|
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
|
||||||
|
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
|
||||||
|
encodingStyle=""
|
||||||
|
/>
|
||||||
<typeMapping
|
<typeMapping
|
||||||
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
||||||
qname="ns:>ContentFormat>mimetype"
|
qname="ns:>ContentFormat>mimetype"
|
||||||
@@ -2543,14 +2551,6 @@
|
|||||||
deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
|
deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
|
||||||
encodingStyle=""
|
encodingStyle=""
|
||||||
/>
|
/>
|
||||||
<typeMapping
|
|
||||||
xmlns:ns="http://www.alfresco.org/ws/service/accesscontrol/1.0"
|
|
||||||
qname="ns:AccessState"
|
|
||||||
type="java:org.alfresco.repo.webservice.accesscontrol.AccessState"
|
|
||||||
serializer="org.apache.axis.encoding.ser.EnumSerializerFactory"
|
|
||||||
deserializer="org.apache.axis.encoding.ser.EnumDeserializerFactory"
|
|
||||||
encodingStyle=""
|
|
||||||
/>
|
|
||||||
<typeMapping
|
<typeMapping
|
||||||
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
xmlns:ns="http://www.alfresco.org/ws/model/content/1.0"
|
||||||
qname="ns:Query"
|
qname="ns:Query"
|
||||||
|
@@ -17,11 +17,18 @@
|
|||||||
|
|
||||||
<!-- Type Definitions -->
|
<!-- Type Definitions -->
|
||||||
|
|
||||||
|
<xsd:simpleType name="AccessStatus">
|
||||||
|
<xsd:restriction base="xsd:string">
|
||||||
|
<xsd:enumeration value="acepted"/>
|
||||||
|
<xsd:enumeration value="declined"/>
|
||||||
|
</xsd:restriction>
|
||||||
|
</xsd:simpleType>
|
||||||
|
|
||||||
<complexType name="ACE">
|
<complexType name="ACE">
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="authority" type="xsd:string"/>
|
<element name="authority" type="xsd:string"/>
|
||||||
<element name="permission" type="xsd:string"/>
|
<element name="permission" type="xsd:string"/>
|
||||||
<element name="allow" type="xsd:boolean"/>
|
<element name="accessStatus" type="acs:AccessStatus"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
<element name="ACE" type="acs:ACE"/>
|
<element name="ACE" type="acs:ACE"/>
|
||||||
@@ -38,7 +45,7 @@
|
|||||||
<complexType name="GetPermissionsResult">
|
<complexType name="GetPermissionsResult">
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="reference" type="cms:Reference"/>
|
<element name="reference" type="cms:Reference"/>
|
||||||
<element name="permissions" type="xsd:string" maxOccures="unbounded" minOccurs="0"/>
|
<element name="permissions" type="xsd:string" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
<element name="GetPermissionsResult" type="acs:GetPermissionsResult"/>
|
<element name="GetPermissionsResult" type="acs:GetPermissionsResult"/>
|
||||||
@@ -46,23 +53,16 @@
|
|||||||
<complexType name="GetClassPermissionsResult">
|
<complexType name="GetClassPermissionsResult">
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="className" type="xsd:string"/>
|
<element name="className" type="xsd:string"/>
|
||||||
<element name="permissions" type="xsd:string" maxOccures="unbounded" minOccurs="0"/>
|
<element name="permissions" type="xsd:string" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
<element name="GetClassPermissionsResult" type="acs:GetClassPermissionsResult"/>
|
<element name="GetClassPermissionsResult" type="acs:GetClassPermissionsResult"/>
|
||||||
|
|
||||||
<xsd:simpleType name="AccessState">
|
|
||||||
<xsd:restriction base="xsd:string">
|
|
||||||
<xsd:enumeration value="acepted"/>
|
|
||||||
<xsd:enumeration value="declined"/>
|
|
||||||
</xsd:restriction>
|
|
||||||
</xsd:simpleType>
|
|
||||||
|
|
||||||
<complexType name="HasPermissionsResult">
|
<complexType name="HasPermissionsResult">
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="reference" type="cms:Reference"/>
|
<element name="reference" type="cms:Reference"/>
|
||||||
<element name="permission" type="xsd:string"/>
|
<element name="permission" type="xsd:string"/>
|
||||||
<element name="accessState" type="acs:AccessState"/>
|
<element name="accessStatus" type="acs:AccessStatus"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
<element name="HasPermissionsResult" type="acs:HasPermissionsResult"/>
|
<element name="HasPermissionsResult" type="acs:HasPermissionsResult"/>
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
<element name="getClassPermissionsResponse">
|
<element name="getClassPermissionsResponse">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="result" type="acs:GetPermissionsResult" maxOccurs="unbounded" minOccurs="0"/>
|
<element name="result" type="acs:GetClassPermissionsResult" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
<element name="hasPermissionsResponse">
|
<element name="hasPermissionsResponse">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element name="results" type="acs:HasPermissionsResult"/>
|
<element name="results" type="acs:HasPermissionsResult" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
Reference in New Issue
Block a user