mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. Fix to allow Take Ownership of a Space through the web-client (current you could only Take Ownership of a document!)
- this is required to solve AWC-442 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -507,7 +507,7 @@ create_space_finish=To create your space click Create Space.
|
|||||||
select_category=Select a category
|
select_category=Select a category
|
||||||
selected_categories=Selected categories
|
selected_categories=Selected categories
|
||||||
no_selected_categories=No categories selected.
|
no_selected_categories=No categories selected.
|
||||||
success_ownership=Successfully took ownership of the document.
|
success_ownership=Successfully took ownership of the object.
|
||||||
inherit_permissions=Inherit Parent Space Permissions
|
inherit_permissions=Inherit Parent Space Permissions
|
||||||
success_inherit_permissions=Successfully changed Inherit Parent Permissions to 'Yes'
|
success_inherit_permissions=Successfully changed Inherit Parent Permissions to 'Yes'
|
||||||
success_not_inherit_permissions=Successfully changed Inherit Parent Permissions to 'No'
|
success_not_inherit_permissions=Successfully changed Inherit Parent Permissions to 'No'
|
||||||
|
@@ -22,9 +22,11 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.event.ActionEvent;
|
import javax.faces.event.ActionEvent;
|
||||||
import javax.faces.model.SelectItem;
|
import javax.faces.model.SelectItem;
|
||||||
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.ForumModel;
|
import org.alfresco.model.ForumModel;
|
||||||
@@ -33,6 +35,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||||
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||||
@@ -52,6 +55,8 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
|||||||
*/
|
*/
|
||||||
public class SpaceDetailsBean
|
public class SpaceDetailsBean
|
||||||
{
|
{
|
||||||
|
private static final String MSG_SUCCESS_OWNERSHIP = "success_ownership";
|
||||||
|
|
||||||
private static final String OUTCOME_RETURN = "showSpaceDetails";
|
private static final String OUTCOME_RETURN = "showSpaceDetails";
|
||||||
|
|
||||||
/** BrowseBean instance */
|
/** BrowseBean instance */
|
||||||
@@ -63,6 +68,9 @@ public class SpaceDetailsBean
|
|||||||
/** PermissionService bean reference */
|
/** PermissionService bean reference */
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
|
||||||
|
/** OwnableService bean reference */
|
||||||
|
private OwnableService ownableService;
|
||||||
|
|
||||||
/** NodeServuce bean reference */
|
/** NodeServuce bean reference */
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
@@ -107,6 +115,16 @@ public class SpaceDetailsBean
|
|||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ownable service instance the bean should use
|
||||||
|
*
|
||||||
|
* @param ownableService The OwnableService
|
||||||
|
*/
|
||||||
|
public void setOwnableService(OwnableService ownableService)
|
||||||
|
{
|
||||||
|
this.ownableService = ownableService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Space this bean is currently representing
|
* Returns the Space this bean is currently representing
|
||||||
*
|
*
|
||||||
@@ -337,6 +355,37 @@ public class SpaceDetailsBean
|
|||||||
return OUTCOME_RETURN;
|
return OUTCOME_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action Handler to take Ownership of the current Space
|
||||||
|
*/
|
||||||
|
public void takeOwnership(ActionEvent event)
|
||||||
|
{
|
||||||
|
UserTransaction tx = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance());
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
|
this.ownableService.takeOwnership(getSpace().getNodeRef());
|
||||||
|
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
String msg = Application.getMessage(context, MSG_SUCCESS_OWNERSHIP);
|
||||||
|
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||||
|
context.addMessage(event.getComponent().getClientId(context), facesMsg);
|
||||||
|
|
||||||
|
// commit the transaction
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
// rollback the transaction
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||||
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigates to next item in the list of Spaces
|
* Navigates to next item in the list of Spaces
|
||||||
*/
|
*/
|
||||||
|
@@ -834,6 +834,10 @@
|
|||||||
<property-name>permissionService</property-name>
|
<property-name>permissionService</property-name>
|
||||||
<value>#{PermissionService}</value>
|
<value>#{PermissionService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>ownableService</property-name>
|
||||||
|
<value>#{OwnableService}</value>
|
||||||
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
|
@@ -110,6 +110,11 @@
|
|||||||
<f:param name="id" value="#{SpaceDetailsBean.id}" />
|
<f:param name="id" value="#{SpaceDetailsBean.id}" />
|
||||||
</a:actionLink>
|
</a:actionLink>
|
||||||
|
|
||||||
|
<%-- Take Ownership --%>
|
||||||
|
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="TakeOwnership">
|
||||||
|
<a:actionLink value="#{msg.take_ownership}" image="/images/icons/take_ownership.gif" actionListener="#{SpaceDetailsBean.takeOwnership}" id="takeOwnership" />
|
||||||
|
</r:permissionEvaluator>
|
||||||
|
|
||||||
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="ChangePermissions">
|
<r:permissionEvaluator value="#{SpaceDetailsBean.space}" allow="ChangePermissions">
|
||||||
<a:actionLink value="#{msg.manage_invited_users}" image="/images/icons/invite.gif" action="manageInvitedUsers" actionListener="#{BrowseBean.setupSpaceAction}">
|
<a:actionLink value="#{msg.manage_invited_users}" image="/images/icons/invite.gif" action="manageInvitedUsers" actionListener="#{BrowseBean.setupSpaceAction}">
|
||||||
<f:param name="id" value="#{SpaceDetailsBean.id}" />
|
<f:param name="id" value="#{SpaceDetailsBean.id}" />
|
||||||
@@ -231,6 +236,7 @@
|
|||||||
columns="1" mode="view" labelStyleClass="propertiesLabel"
|
columns="1" mode="view" labelStyleClass="propertiesLabel"
|
||||||
externalConfig="true" />
|
externalConfig="true" />
|
||||||
<h:messages globalOnly="true" styleClass="errorMessage" layout="table" />
|
<h:messages globalOnly="true" styleClass="errorMessage" layout="table" />
|
||||||
|
<h:message for="takeOwnership" styleClass="statusMessage" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
Reference in New Issue
Block a user