mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
MERGE DEV/3.2_INVITATION to HEAD
MOB-124 First cut of invitation service First cut group site membership git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13378 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
<import resource="classpath:alfresco/audit-services-context.xml" />
|
<import resource="classpath:alfresco/audit-services-context.xml" />
|
||||||
<import resource="classpath:alfresco/attributes-service-context.xml"/>
|
<import resource="classpath:alfresco/attributes-service-context.xml"/>
|
||||||
<import resource="classpath:alfresco/deployment-service-context.xml"/>
|
<import resource="classpath:alfresco/deployment-service-context.xml"/>
|
||||||
|
<import resource="classpath:alfresco/invitation-service-context.xml"/>
|
||||||
<import resource="classpath:alfresco/linkvalidation-service-context.xml"/>
|
<import resource="classpath:alfresco/linkvalidation-service-context.xml"/>
|
||||||
<import resource="classpath:alfresco/remote-services-context.xml"/>
|
<import resource="classpath:alfresco/remote-services-context.xml"/>
|
||||||
<import resource="classpath*:alfresco/office-addin-context.xml"/>
|
<import resource="classpath*:alfresco/office-addin-context.xml"/>
|
||||||
|
@@ -371,18 +371,38 @@
|
|||||||
<prop key="mimetype">text/xml</prop>
|
<prop key="mimetype">text/xml</prop>
|
||||||
<prop key="redeploy">false</prop>
|
<prop key="redeploy">false</prop>
|
||||||
</props>
|
</props>
|
||||||
|
|
||||||
|
<props>
|
||||||
|
<prop key="engineId">jbpm</prop>
|
||||||
|
<prop key="location">alfresco/workflow/invitation-nominated_processdefinition.xml</prop>
|
||||||
|
<prop key="mimetype">text/xml</prop>
|
||||||
|
<prop key="redeploy">false</prop>
|
||||||
|
</props>
|
||||||
|
|
||||||
|
<props>
|
||||||
|
<prop key="engineId">jbpm</prop>
|
||||||
|
<prop key="location">alfresco/workflow/invitation-moderated_processdefinition.xml</prop>
|
||||||
|
<prop key="mimetype">text/xml</prop>
|
||||||
|
<prop key="redeploy">true</prop>
|
||||||
|
</props>
|
||||||
|
|
||||||
|
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="models">
|
<property name="models">
|
||||||
<list>
|
<list>
|
||||||
<value>alfresco/workflow/workflowModel.xml</value>
|
<value>alfresco/workflow/workflowModel.xml</value>
|
||||||
<value>alfresco/workflow/wcmWorkflowModel.xml</value>
|
<value>alfresco/workflow/wcmWorkflowModel.xml</value>
|
||||||
|
<value>alfresco/workflow/invitation-nominated-workflow-model.xml</value>
|
||||||
|
<value>alfresco/workflow/invitation-moderated-workflow-model.xml</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="labels">
|
<property name="labels">
|
||||||
<list>
|
<list>
|
||||||
<value>alfresco/workflow/workflow-messages</value>
|
<value>alfresco/workflow/workflow-messages</value>
|
||||||
<value>alfresco/workflow/wcm-workflow-messages</value>
|
<value>alfresco/workflow/wcm-workflow-messages</value>
|
||||||
|
<value>alfresco/workflow/invitation-nominated-workflow-messages</value>
|
||||||
|
<value>alfresco/workflow/invitation-moderated-workflow-messages</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="repositoryWorkflowDefsLocations" ref="customWorkflowDefsRepositoryLocation"/>
|
<property name="repositoryWorkflowDefsLocations" ref="customWorkflowDefsRepositoryLocation"/>
|
||||||
|
34
config/alfresco/bootstrap/remote-api-context.xml
Normal file
34
config/alfresco/bootstrap/remote-api-context.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||||
|
<!--
|
||||||
|
Remote API Bootstrap Extension Sequence. This file specifies the
|
||||||
|
initialisation (and order of initialisation) to perform during Repository
|
||||||
|
startup for beans in the Remote API project.
|
||||||
|
-->
|
||||||
|
<beans>
|
||||||
|
<bean id="remote-api.workflowBootstrap" parent="workflowDeployer">
|
||||||
|
<property name="workflowDefinitions">
|
||||||
|
<list>
|
||||||
|
<!-- Remote API invite workflow definition -->
|
||||||
|
<props>
|
||||||
|
<prop key="engineId">jbpm</prop>
|
||||||
|
<prop key="location">alfresco/workflow/invite_processdefinition.xml</prop>
|
||||||
|
<prop key="mimetype">text/xml</prop>
|
||||||
|
<prop key="redeploy">false</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="models">
|
||||||
|
<list>
|
||||||
|
<!-- Remote API invite workflow Model -->
|
||||||
|
<value>alfresco/workflow/invite-workflow-model.xml</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="labels">
|
||||||
|
<list>
|
||||||
|
<!-- Remote API invite workflow Model -->
|
||||||
|
<value>alfresco/workflow/invite-workflow-messages</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
61
config/alfresco/invitation-service-context.xml
Normal file
61
config/alfresco/invitation-service-context.xml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- Invitation Service Configuration File -->
|
||||||
|
<bean id="invitationService" class="org.alfresco.repo.invitation.InvitationServiceImpl">
|
||||||
|
<property name="workflowService" ref="WorkflowService"/>
|
||||||
|
<property name="personService" ref="PersonService"/>
|
||||||
|
<property name="permissionService" ref="PermissionService"/>
|
||||||
|
<property name="authenticationService" ref="AuthenticationService"/>
|
||||||
|
<property name="mutableAuthenticationDao" ref="authenticationDao"/>
|
||||||
|
<property name="siteService" ref="SiteService"/>
|
||||||
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
|
<property name="nodeService" ref="NodeService"/>
|
||||||
|
<property name="userNameGenerator" ref="userNameGenerator"/>
|
||||||
|
<property name="passwordGenerator" ref="passwordGenerator"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- Site service security bean -->
|
||||||
|
<bean id="InvitationService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
|
||||||
|
|
||||||
|
<!-- Site service transaction bean -->
|
||||||
|
<bean id="InvitationService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||||
|
<property name="transactionManager">
|
||||||
|
<ref bean="transactionManager"/>
|
||||||
|
</property>
|
||||||
|
<property name="transactionAttributes">
|
||||||
|
<props>
|
||||||
|
<prop key="*">${server.transaction.mode.default}</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="InvitationService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
<property name="proxyInterfaces">
|
||||||
|
<list>
|
||||||
|
<value>org.alfresco.service.cmr.invitation.InvitationService</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="targetName">
|
||||||
|
<value>invitationService</value>
|
||||||
|
</property>
|
||||||
|
<property name="interceptorNames">
|
||||||
|
<list>
|
||||||
|
<idref local="InvitationService_transaction"/>
|
||||||
|
<idref bean="AuditMethodInterceptor"/>
|
||||||
|
<idref bean="exceptionTranslator"/>
|
||||||
|
<idref local="InvitationService_security"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="invitationResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
|
||||||
|
<property name="resourceBundles">
|
||||||
|
<list>
|
||||||
|
<value>alfresco.messages.invitation-service</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
7
config/alfresco/messages/invitation-service.properties
Normal file
7
config/alfresco/messages/invitation-service.properties
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Invitation service
|
||||||
|
|
||||||
|
invitation.error.not_found "Invitation not found invitationId: {0}"
|
||||||
|
|
||||||
|
invitation.cancel.not_site_manager "Current user, {0}, cannot cancel invitation: {1} because they are not a Site Manager for site: {2}
|
||||||
|
|
||||||
|
invitation.invite.unable_generate_id "Unable to generate a user name for invitee, which doesn't already belong to someone else firstName:{0} lastName:{1} email:{2}"
|
11
config/alfresco/messages/site-service.properties
Normal file
11
config/alfresco/messages/site-service.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Site service externalised display strings
|
||||||
|
|
||||||
|
site_service.unable_to_create=Unable to create site because the site short name {0} is already in use. Site short names must be unique.
|
||||||
|
site_service.can_not_update=Can not update site {0} because it does not exist.
|
||||||
|
site_service.can_not_delete=Can not delete site {0} because it does not exist.
|
||||||
|
site_service.site_no_exist=Site {0} does not exist.
|
||||||
|
site_service.do_not_remove_manager=A site requires at least one site manager. You can not remove {0} from the site membership because they are currently the only site manager.
|
||||||
|
site_service.can_not_reomve_memebership=The current user does not have sufficient permissions to delete membership details of the site {0}.
|
||||||
|
site_service.do_not_change_manager=A site requires at least one site manager. You can not change the role of {0}, because they are currently the only site manager.
|
||||||
|
site_service.can_not_change_memebership=The current user does not have permissions to modify the membership details of the site {0}.
|
||||||
|
site_service.site_container_not_folder=Site container {0} does not refer to a folder.
|
@@ -40,6 +40,10 @@
|
|||||||
<title>Site Preset</title>
|
<title>Site Preset</title>
|
||||||
<type>d:text</type>
|
<type>d:text</type>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="st:siteVisibility">
|
||||||
|
<title>Site Visibility</title>
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
</properties>
|
</properties>
|
||||||
<mandatory-aspects>
|
<mandatory-aspects>
|
||||||
<aspect>cm:titled</aspect>
|
<aspect>cm:titled</aspect>
|
||||||
@@ -47,7 +51,7 @@
|
|||||||
</type>
|
</type>
|
||||||
|
|
||||||
<!-- Site Root Folder: -->
|
<!-- Site Root Folder: -->
|
||||||
<!-- - all sites are stored beneth the site root folder -->
|
<!-- - all sites are stored beneath the site root folder -->
|
||||||
<type name="st:sites">
|
<type name="st:sites">
|
||||||
<title>Sites</title>
|
<title>Sites</title>
|
||||||
<parent>cm:folder</parent>
|
<parent>cm:folder</parent>
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
<!-- Site service bean -->
|
<!-- Site service bean -->
|
||||||
<bean id="SiteService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="SiteService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
<property name="proxyInterfaces">
|
<property name="proxyInterfaces">
|
||||||
<value>org.alfresco.repo.site.SiteService</value>
|
<value>org.alfresco.service.cmr.site.SiteService</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="target">
|
<property name="target">
|
||||||
<ref bean="siteService"/>
|
<ref bean="siteService"/>
|
||||||
@@ -50,6 +50,15 @@
|
|||||||
<bean id="SiteService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
|
<bean id="SiteService_security" class="org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- I18N -->
|
||||||
|
<bean id="siteServiceResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
|
||||||
|
<property name="resourceBundles">
|
||||||
|
<list>
|
||||||
|
<value>alfresco.messages.site-service</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="siteService" class="org.alfresco.repo.site.SiteServiceImpl" init-method="init">
|
<bean id="siteService" class="org.alfresco.repo.site.SiteServiceImpl" init-method="init">
|
||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="fileFolderService" ref="FileFolderService"/>
|
<property name="fileFolderService" ref="FileFolderService"/>
|
||||||
|
@@ -0,0 +1,12 @@
|
|||||||
|
# Display labels for out-of-the-box Site-oriented Workflows
|
||||||
|
|
||||||
|
#
|
||||||
|
# Moderated Invitation
|
||||||
|
#
|
||||||
|
|
||||||
|
wf_invitation-moderated.workflow.title=Invitation (Moderated)
|
||||||
|
wf_invitation-moderated.workflow.description=Moderated invitation to a resource such as a web site.
|
||||||
|
|
||||||
|
wf_invitation-moderated-model.type.approveInvitationTask.title=Approve Invitation
|
||||||
|
wf_invitation-moderated-model.type.approveInvitationTask.description=Approve Invitation
|
||||||
|
|
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- Moderated invitation workflow -->
|
||||||
|
|
||||||
|
<model name="wf:invitation-moderated-workflow-model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
||||||
|
|
||||||
|
<imports>
|
||||||
|
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
|
||||||
|
<import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
|
||||||
|
<import uri="http://www.alfresco.org/model/workflow/1.0" prefix="wf" />
|
||||||
|
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
|
||||||
|
</imports>
|
||||||
|
|
||||||
|
<types>
|
||||||
|
<type name="wf:moderatedInvitationSubmitTask">
|
||||||
|
<parent>bpm:startTask</parent>
|
||||||
|
<mandatory-aspects>
|
||||||
|
<aspect>bpm:assignee</aspect>
|
||||||
|
<aspect>bpm:groupAssignee</aspect>
|
||||||
|
<aspect>wf:moderatedInvitationStats</aspect>
|
||||||
|
</mandatory-aspects>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:moderatedInvitationReviewTask">
|
||||||
|
<parent>bpm:workflowTask</parent>
|
||||||
|
<properties>
|
||||||
|
<property name="wf:reviewComments">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="cm:owner">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<mandatory-aspects>
|
||||||
|
<aspect>bpm:groupAssignee</aspect>
|
||||||
|
<aspect>cm:ownable</aspect>
|
||||||
|
<aspect>wf:moderatedInvitationStats</aspect>
|
||||||
|
</mandatory-aspects>
|
||||||
|
|
||||||
|
</type>
|
||||||
|
|
||||||
|
</types>
|
||||||
|
|
||||||
|
<aspects>
|
||||||
|
<aspect name="wf:moderatedInvitationStats">
|
||||||
|
<properties>
|
||||||
|
<property name="wf:inviteeUserName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:resourceType">
|
||||||
|
<type>d:text</type>
|
||||||
|
<default>WEB_SITE</default>
|
||||||
|
</property>
|
||||||
|
<property name="wf:resourceName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeRole">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeComments">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</aspect>
|
||||||
|
</aspects>
|
||||||
|
|
||||||
|
|
||||||
|
</model>
|
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- Moderated Invitation Workflow -->
|
||||||
|
|
||||||
|
<process-definition xmlns="urn:jbpm.org:jpdl-3.1"
|
||||||
|
name="wf:invitation-moderated">
|
||||||
|
|
||||||
|
<swimlane name="initiator">
|
||||||
|
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
|
||||||
|
<actor>#{bpm_assignee.properties['cm:userName']}</actor>
|
||||||
|
</assignment>
|
||||||
|
</swimlane>
|
||||||
|
|
||||||
|
<start-state name="start">
|
||||||
|
<task name="wf:moderatedInvitationSubmitTask" swimlane="initiator" />
|
||||||
|
<transition to="review" name=""></transition>
|
||||||
|
</start-state>
|
||||||
|
|
||||||
|
<swimlane name="approver">
|
||||||
|
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
|
||||||
|
<pooledactors>#{bpm_groupAssignee}</pooledactors>
|
||||||
|
</assignment>
|
||||||
|
</swimlane>
|
||||||
|
|
||||||
|
<task-node name="review">
|
||||||
|
<task name="wf:moderatedInvitationReviewTask" swimlane="approver" />
|
||||||
|
<transition name="reject" to="rejected">
|
||||||
|
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
|
||||||
|
<script>
|
||||||
|
<variable name="wf_reviewer" access="write" />
|
||||||
|
<expression>person.properties.userName</expression>
|
||||||
|
</script>
|
||||||
|
</action>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<transition name="approve" to="approved">
|
||||||
|
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
|
||||||
|
<script>
|
||||||
|
<variable name="wf_reviewer" access="write" />
|
||||||
|
<expression>person.properties.userName</expression>
|
||||||
|
</script>
|
||||||
|
</action>
|
||||||
|
</transition>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<task-node name="rejected">
|
||||||
|
<transition name="" to="end" >
|
||||||
|
<action class="org.alfresco.repo.invitation.ModeratedActionReject"/>
|
||||||
|
</transition>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<task-node name="approved">
|
||||||
|
<transition name="" to="end" >
|
||||||
|
<action class="org.alfresco.repo.invitation.ModeratedActionApprove"/>
|
||||||
|
</transition>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<end-state name="end" />
|
||||||
|
|
||||||
|
</process-definition>
|
@@ -0,0 +1,40 @@
|
|||||||
|
# Display labels for out-of-the-box Site-oriented Workflows
|
||||||
|
|
||||||
|
#
|
||||||
|
# Invite Workflow
|
||||||
|
#
|
||||||
|
|
||||||
|
wf_invite.workflow.title=Invitation (Nominated)
|
||||||
|
wf_invite.workflow.description=Invitation to a Share Site, nominated by a site manager
|
||||||
|
|
||||||
|
# Invite Task Definitions
|
||||||
|
|
||||||
|
wf_invite-workflow-model.type.wf_inviteToSiteTask.title=Start Invite
|
||||||
|
wf_invite-workflow-model.type.wf_inviteToSiteTask.description=Start an invite to a Site
|
||||||
|
wf_invite-workflow-model.type.wf_invitePendingTask.title=Site Invite
|
||||||
|
wf_invite-workflow-model.type.wf_invitePendingTask.description=Invite to a Site
|
||||||
|
wf_invite-workflow-model.type.wf_rejectInviteTask.title=Rejected
|
||||||
|
wf_invite-workflow-model.type.wf_rejectInviteTask.description=Rejected
|
||||||
|
wf_invite-workflow-model.type.wf_acceptInviteTask.title=Accepted
|
||||||
|
wf_invite-workflow-model.type.wf_acceptInviteTask.description=Accepted
|
||||||
|
|
||||||
|
# Invite Process Definitions
|
||||||
|
|
||||||
|
wf_invite.node.start.title=Start
|
||||||
|
wf_invite.node.start.description=Start
|
||||||
|
wf_invite.node.invitePending.title=Invite Pending
|
||||||
|
wf_invite.node.invitePending.description=Invite Pending
|
||||||
|
wf_invite.node.invitePending.transition.reject.title=Reject
|
||||||
|
wf_invite.node.invitePending.transition.reject.description=Reject
|
||||||
|
wf_invite.node.invitePending.transition.accept.title=Accept
|
||||||
|
wf_invite.node.invitePending.transition.accept.description=Accept
|
||||||
|
wf_invite.node.inviteRejected.title=Rejected
|
||||||
|
wf_invite.node.inviteRejected.description=Rejected
|
||||||
|
wf_invite.task.wf_rejectInviteTask.title=Rejected
|
||||||
|
wf_invite.task.wf_rejectInviteTask.description=Rejected
|
||||||
|
wf_invite.node.inviteAccepted.title=Accepted
|
||||||
|
wf_invite.node.inviteAccepted.description=Accepted
|
||||||
|
wf_invite.task.wf_acceptInviteTask.title=Accepted
|
||||||
|
wf_invite.task.wf_acceptInviteTask.description=Accepted
|
||||||
|
wf_invite.node.end.title=End
|
||||||
|
wf_invite.node.end.description=End
|
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- Nominated Invitation Workflow Model -->
|
||||||
|
|
||||||
|
<model name="wf:invite-workflow-model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
||||||
|
|
||||||
|
<imports>
|
||||||
|
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
|
||||||
|
<import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
|
||||||
|
<import uri="http://www.alfresco.org/model/workflow/1.0" prefix="wf" />
|
||||||
|
</imports>
|
||||||
|
|
||||||
|
<types>
|
||||||
|
|
||||||
|
<!-- Custom Tasks -->
|
||||||
|
<type name="wf:inviteToSiteTask">
|
||||||
|
<parent>bpm:startTask</parent>
|
||||||
|
<properties>
|
||||||
|
<property name="wf:serverPath">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:acceptUrl">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:rejectUrl">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteTicket">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviterUserName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeUserName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeFirstName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeLastName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeGenPassword">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:resourceType">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:resourceName">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
<property name="wf:inviteeSiteRole">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
<mandatory-aspects>
|
||||||
|
<aspect>bpm:assignee</aspect>
|
||||||
|
</mandatory-aspects>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:invitePendingTask">
|
||||||
|
<parent>bpm:workflowTask</parent>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:acceptInviteTask">
|
||||||
|
<parent>bpm:workflowTask</parent>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:rejectInviteTask">
|
||||||
|
<parent>bpm:workflowTask</parent>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
</types>
|
||||||
|
</model>
|
@@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- Nominated invitation -->
|
||||||
|
|
||||||
|
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:invite">
|
||||||
|
|
||||||
|
<swimlane name="initiator"/>
|
||||||
|
|
||||||
|
<start-state name="start">
|
||||||
|
|
||||||
|
<task name="wf:inviteToSiteTask" swimlane="initiator" />
|
||||||
|
|
||||||
|
<transition name="sendInvite" to="invitePending">
|
||||||
|
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
|
||||||
|
<script>
|
||||||
|
var workflowId = workflowinstanceid;
|
||||||
|
var inviterPerson = people.getPerson(wf_inviterUserName);
|
||||||
|
var inviteePerson = people.getPerson(wf_inviteeUserName);
|
||||||
|
var site = siteService.getSite(wf_resourceName);
|
||||||
|
var siteName = site.shortName;
|
||||||
|
if (site.title.length() > 0)
|
||||||
|
{
|
||||||
|
siteName = site.title;
|
||||||
|
}
|
||||||
|
var params = "?inviteId=" + workflowId +
|
||||||
|
"&inviteeUserName=" + wf_inviteeUserName +
|
||||||
|
"&siteShortName=" + wf_resourceName +
|
||||||
|
"&inviteTicket=" + wf_inviteTicket;
|
||||||
|
var acceptLink = wf_serverPath + wf_acceptUrl + params;
|
||||||
|
var rejectLink = wf_serverPath + wf_rejectUrl + params;
|
||||||
|
var mail = actions.create("mail");
|
||||||
|
mail.parameters.from = inviterPerson.properties["cm:email"];
|
||||||
|
mail.parameters.to = inviteePerson.properties["cm:email"];
|
||||||
|
mail.parameters.subject = "Invitation to join '" + siteName + "' site";
|
||||||
|
|
||||||
|
var results = search.luceneSearch(" PATH:\"app:company_home/app:dictionary/app:email_templates/cm:invite/cm:invite-email.ftl\"");
|
||||||
|
var template = results[0];
|
||||||
|
|
||||||
|
var args = [];
|
||||||
|
args["inviteePersonRef"] = inviteePerson.nodeRef.toString();
|
||||||
|
args["inviterPersonRef"] = inviterPerson.nodeRef.toString();
|
||||||
|
args["siteName"] = siteName;
|
||||||
|
args["inviteeSiteRole"] = wf_inviteeSiteRole;
|
||||||
|
args["inviteeUserName"] = wf_inviteeUserName;
|
||||||
|
args["inviteeGenPassword"] = wf_inviteeGenPassword;
|
||||||
|
args["acceptLink"] = acceptLink;
|
||||||
|
args["rejectLink"] = rejectLink;
|
||||||
|
var mail_text = inviteePerson.processTemplate(template, args);
|
||||||
|
|
||||||
|
mail.parameters.text = mail_text;
|
||||||
|
mail.execute(bpm_package);
|
||||||
|
</script>
|
||||||
|
</action>
|
||||||
|
</transition>
|
||||||
|
</start-state>
|
||||||
|
|
||||||
|
<swimlane name="assignee">
|
||||||
|
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
|
||||||
|
<actor>#{bpm_assignee.properties['cm:userName']}</actor>
|
||||||
|
</assignment>
|
||||||
|
</swimlane>
|
||||||
|
|
||||||
|
<task-node name="invitePending">
|
||||||
|
<task name="wf:invitePendingTask" swimlane="assignee" />
|
||||||
|
<transition name="accept" to="inviteAccepted">
|
||||||
|
<action class="org.alfresco.repo.invitation.site.AcceptInviteAction"/>
|
||||||
|
</transition>
|
||||||
|
<transition name="reject" to="inviteRejected">
|
||||||
|
<action class="org.alfresco.repo.invitation.site.RejectInviteAction"/>
|
||||||
|
</transition>
|
||||||
|
<transition name="cancel" to="end">
|
||||||
|
<action class="org.alfresco.repo.invitation.site.CancelInviteAction"/>
|
||||||
|
</transition>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<task-node name="inviteAccepted">
|
||||||
|
<task name="wf:acceptInviteTask" swimlane="initiator" />
|
||||||
|
<transition name="end" to="end"/>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<task-node name="inviteRejected">
|
||||||
|
<task name="wf:rejectInviteTask" swimlane="initiator" />
|
||||||
|
<transition name="end" to="end"/>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<end-state name="end" />
|
||||||
|
|
||||||
|
</process-definition>
|
@@ -30,14 +30,14 @@ import java.util.Set;
|
|||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.site.SiteInfo;
|
|
||||||
import org.alfresco.repo.site.SiteModel;
|
import org.alfresco.repo.site.SiteModel;
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.repo.site.SiteServiceImpl;
|
import org.alfresco.repo.site.SiteServiceImpl;
|
||||||
import org.alfresco.service.cmr.security.AccessPermission;
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityType;
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch's the site permission model to use groups to contain users.
|
* Patch's the site permission model to use groups to contain users.
|
||||||
|
@@ -88,11 +88,6 @@ public class AVMServiceTestBase extends TestCase
|
|||||||
|
|
||||||
protected static AuthenticationService fAuthService;
|
protected static AuthenticationService fAuthService;
|
||||||
|
|
||||||
public void testSetup()
|
|
||||||
{
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup for AVM tests. Note that we set the polling
|
* Setup for AVM tests. Note that we set the polling
|
||||||
* interval for the reaper to 4 seconds so that tests will
|
* interval for the reaper to 4 seconds so that tests will
|
||||||
|
@@ -258,7 +258,9 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
}
|
}
|
||||||
// Clear out the new nodes.
|
// Clear out the new nodes.
|
||||||
List<Long> allLayeredNodeIDs = AVMDAOs.Instance().fAVMNodeDAO.getNewLayeredInStoreIDs(me);
|
List<Long> allLayeredNodeIDs = AVMDAOs.Instance().fAVMNodeDAO.getNewLayeredInStoreIDs(me);
|
||||||
|
|
||||||
AVMDAOs.Instance().fAVMNodeDAO.clearNewInStore(me);
|
AVMDAOs.Instance().fAVMNodeDAO.clearNewInStore(me);
|
||||||
|
|
||||||
AVMDAOs.Instance().fAVMNodeDAO.clear();
|
AVMDAOs.Instance().fAVMNodeDAO.clear();
|
||||||
List<Long> layeredNodeIDs = new ArrayList<Long>();
|
List<Long> layeredNodeIDs = new ArrayList<Long>();
|
||||||
for (Long layeredID : allLayeredNodeIDs)
|
for (Long layeredID : allLayeredNodeIDs)
|
||||||
|
75
source/java/org/alfresco/repo/invitation/InvitationImpl.java
Normal file
75
source/java/org/alfresco/repo/invitation/InvitationImpl.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation.ResourceType;
|
||||||
|
|
||||||
|
/* package scope */ abstract class InvitationImpl
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Who is this invitation for
|
||||||
|
*/
|
||||||
|
private String inviteeUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique reference for this invitation
|
||||||
|
*/
|
||||||
|
private String inviteId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which resource is this invitation for ?
|
||||||
|
*/
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What sort of invitation is this invitation for e.g. WEB_SITE or WEB_PROJECT
|
||||||
|
*/
|
||||||
|
private Invitation.ResourceType resourceType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new InvitationImpl
|
||||||
|
*/
|
||||||
|
public InvitationImpl()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What sort of resource is it
|
||||||
|
* @return the resource type
|
||||||
|
*/
|
||||||
|
public ResourceType getResourceType()
|
||||||
|
{
|
||||||
|
return resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceType(ResourceType resourceType)
|
||||||
|
{
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteeUserName(String inviteeUserName) {
|
||||||
|
this.inviteeUserName = inviteeUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInviteeUserName() {
|
||||||
|
return inviteeUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteId(String inviteId) {
|
||||||
|
this.inviteId = inviteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInviteId() {
|
||||||
|
return inviteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceName(String resourceName) {
|
||||||
|
this.resourceName = resourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResourceName() {
|
||||||
|
return resourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Invitation process is the interface provided by the invitation service to be
|
||||||
|
* implemented by each resource's invitation handler
|
||||||
|
*
|
||||||
|
* This invitation process is the unmoderated invite someone else.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface InvitationProcess
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* someone starts the invitation process
|
||||||
|
*/
|
||||||
|
public Invitation invite(Invitation request, String comment);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cancel this request
|
||||||
|
*/
|
||||||
|
public void cancel (Invitation request);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
public interface InvitationProcessDescription
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description about which invitation processes are available
|
||||||
|
*/
|
||||||
|
public class InvitationProcessDescriptionImpl implements InvitationProcessDescription
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationSearchCriteria;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation.ResourceType;
|
||||||
|
|
||||||
|
public class InvitationSearchCriteriaImpl implements InvitationSearchCriteria
|
||||||
|
{
|
||||||
|
private String invitee;
|
||||||
|
private String inviter;
|
||||||
|
private String resourceName;
|
||||||
|
private ResourceType resourceType;
|
||||||
|
private InvitationSearchCriteria.InvitationType invitationType = InvitationSearchCriteria.InvitationType.ALL;
|
||||||
|
|
||||||
|
public void setInvitee(String invitee) {
|
||||||
|
this.invitee = invitee;
|
||||||
|
}
|
||||||
|
public String getInvitee() {
|
||||||
|
return invitee;
|
||||||
|
}
|
||||||
|
public void setInviter(String inviter) {
|
||||||
|
this.inviter = inviter;
|
||||||
|
}
|
||||||
|
public String getInviter() {
|
||||||
|
return inviter;
|
||||||
|
}
|
||||||
|
public void setResourceName(String resourceName) {
|
||||||
|
this.resourceName = resourceName;
|
||||||
|
}
|
||||||
|
public String getResourceName() {
|
||||||
|
return resourceName;
|
||||||
|
}
|
||||||
|
public void setResourceType(ResourceType resourceType) {
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
}
|
||||||
|
public ResourceType getResourceType() {
|
||||||
|
return resourceType;
|
||||||
|
}
|
||||||
|
public InvitationType getInvitationType()
|
||||||
|
{
|
||||||
|
return invitationType;
|
||||||
|
}
|
||||||
|
public void setInvitationType(InvitationType invitationType)
|
||||||
|
{
|
||||||
|
this.invitationType = invitationType;
|
||||||
|
}
|
||||||
|
}
|
1198
source/java/org/alfresco/repo/invitation/InvitationServiceImpl.java
Normal file
1198
source/java/org/alfresco/repo/invitation/InvitationServiceImpl.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,739 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.site.SiteModel;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationExceptionUserError;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationSearchCriteria;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.ModeratedInvitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.NominatedInvitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation.ResourceType;
|
||||||
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.repository.ScriptService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
|
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||||
|
import org.alfresco.util.BaseAlfrescoSpringTest;
|
||||||
|
import org.alfresco.util.PropertyMap;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Unit tests of Invitation Service
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InvitationServiceImplTest extends BaseAlfrescoSpringTest
|
||||||
|
{
|
||||||
|
private SiteService siteService;
|
||||||
|
private AuthenticationComponent authenticationComponent;
|
||||||
|
private PersonService personService;
|
||||||
|
private InvitationService invitationService;
|
||||||
|
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||||
|
|
||||||
|
private final String SITE_SHORT_NAME_INVITE = "InvitationTest";
|
||||||
|
private final String SITE_SHORT_NAME_RED = "InvitationTestRed";
|
||||||
|
private final String SITE_SHORT_NAME_BLUE = "InvitationTestBlue";
|
||||||
|
public static String PERSON_FIRSTNAME = "InvitationFirstName123";
|
||||||
|
public static String PERSON_LASTNAME = "InvitationLastName123";
|
||||||
|
public static String PERSON_JOBTITLE = "JobTitle123";
|
||||||
|
public static String PERSON_ORG = "Organisation123";
|
||||||
|
|
||||||
|
public static String USER_MANAGER = "InvitationServiceManagerOne";
|
||||||
|
public static String USER_ONE = "InvitationServiceAlice";
|
||||||
|
public static String USER_TWO = "InvitationServiceBob";
|
||||||
|
public static String USER_EVE = "InvitationServiceEve";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called during the transaction setup
|
||||||
|
*/
|
||||||
|
protected void onSetUpInTransaction() throws Exception
|
||||||
|
{
|
||||||
|
super.onSetUpInTransaction();
|
||||||
|
this.invitationService = (InvitationService)this.applicationContext.getBean("InvitationService");
|
||||||
|
this.siteService = (SiteService)this.applicationContext.getBean("SiteService");
|
||||||
|
this.personService = (PersonService)this.applicationContext.getBean("PersonService");
|
||||||
|
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
|
||||||
|
this.mutableAuthenticationDao = (MutableAuthenticationDao)this.applicationContext.getBean("authenticationDao");
|
||||||
|
|
||||||
|
createPerson(USER_MANAGER, "");
|
||||||
|
createPerson(USER_ONE, "");
|
||||||
|
createPerson(USER_TWO, "");
|
||||||
|
createPerson(USER_EVE, "");
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
|
||||||
|
SiteInfo siteInfo = siteService.getSite(SITE_SHORT_NAME_INVITE);
|
||||||
|
if (siteInfo == null)
|
||||||
|
{
|
||||||
|
siteService.createSite("InviteSitePreset",
|
||||||
|
SITE_SHORT_NAME_INVITE,
|
||||||
|
"InviteSiteTitle",
|
||||||
|
"InviteSiteDescription",
|
||||||
|
SiteVisibility.MODERATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
SiteInfo siteInfoRed = siteService.getSite(SITE_SHORT_NAME_RED);
|
||||||
|
if (siteInfoRed == null)
|
||||||
|
{
|
||||||
|
siteService.createSite("InviteSiteRed",
|
||||||
|
SITE_SHORT_NAME_RED,
|
||||||
|
"InviteSiteTitle",
|
||||||
|
"InviteSiteDescription",
|
||||||
|
SiteVisibility.MODERATED);
|
||||||
|
}
|
||||||
|
SiteInfo siteInfoBlue = siteService.getSite(SITE_SHORT_NAME_BLUE);
|
||||||
|
if (siteInfoBlue == null)
|
||||||
|
{
|
||||||
|
siteService.createSite("InviteSiteBlue",
|
||||||
|
SITE_SHORT_NAME_BLUE,
|
||||||
|
"InviteSiteTitle",
|
||||||
|
"InviteSiteDescription",
|
||||||
|
SiteVisibility.MODERATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onTearDownInTransaction() throws Exception
|
||||||
|
{
|
||||||
|
super.onTearDownInTransaction();
|
||||||
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
siteService.deleteSite(SITE_SHORT_NAME_INVITE);
|
||||||
|
siteService.deleteSite(SITE_SHORT_NAME_RED);
|
||||||
|
siteService.deleteSite(SITE_SHORT_NAME_BLUE);
|
||||||
|
deletePersonByUserName(USER_ONE);
|
||||||
|
deletePersonByUserName(USER_TWO);
|
||||||
|
deletePersonByUserName(USER_EVE);
|
||||||
|
deletePersonByUserName(USER_MANAGER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* end of setup now for some real tests
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testConfiguration()
|
||||||
|
{
|
||||||
|
assertNotNull("Invitation service is null", invitationService);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Nominated Invitation
|
||||||
|
* read it.
|
||||||
|
* search for it
|
||||||
|
* cancel it
|
||||||
|
* search for it again (and fail to find it)
|
||||||
|
* Create a Nominated Invitation
|
||||||
|
* read it.
|
||||||
|
* search for it
|
||||||
|
* reject it
|
||||||
|
* Create a Nominated Invitation
|
||||||
|
* read it.
|
||||||
|
* accept it
|
||||||
|
*/
|
||||||
|
public void testNominatedInvitation() throws Exception
|
||||||
|
{
|
||||||
|
String inviteeFirstName = PERSON_FIRSTNAME;
|
||||||
|
String inviteeLastName = PERSON_LASTNAME;
|
||||||
|
String inviteeEmail = "123";
|
||||||
|
String inviteeUserName = "invitee@alfrescotesting.com";
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String serverPath = "wibble";
|
||||||
|
String acceptUrl = "froob";
|
||||||
|
String rejectUrl = "marshmallow";
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
|
||||||
|
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(inviteeFirstName,
|
||||||
|
inviteeLastName,
|
||||||
|
inviteeEmail,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole,
|
||||||
|
serverPath,
|
||||||
|
acceptUrl,
|
||||||
|
rejectUrl) ;
|
||||||
|
|
||||||
|
assertNotNull("nominated invitation is null", nominatedInvitation);
|
||||||
|
String inviteId = nominatedInvitation.getInviteId();
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, nominatedInvitation.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, nominatedInvitation.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, nominatedInvitation.getInviteeUserName());
|
||||||
|
assertEquals("resource type name wrong", resourceType, nominatedInvitation.getResourceType());
|
||||||
|
assertEquals("resource name wrong", resourceName, nominatedInvitation.getResourceName());
|
||||||
|
assertEquals("role name wrong", inviteeRole, nominatedInvitation.getRoleName());
|
||||||
|
assertEquals("server path wrong", serverPath, nominatedInvitation.getServerPath());
|
||||||
|
assertEquals("accept URL wrong", acceptUrl, nominatedInvitation.getAcceptUrl());
|
||||||
|
assertEquals("reject URL wrong", rejectUrl, nominatedInvitation.getRejectUrl());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now we have an invitation get it and check the details have been returned correctly.
|
||||||
|
*/
|
||||||
|
NominatedInvitation invitation = (NominatedInvitation)invitationService.getInvitation(inviteId);
|
||||||
|
|
||||||
|
assertNotNull("invitation is null", invitation);
|
||||||
|
assertEquals("invite id wrong", inviteId, invitation.getInviteId());
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, invitation.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, invitation.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, invitation.getInviteeUserName());
|
||||||
|
assertEquals("resource type name wrong", resourceType, invitation.getResourceType());
|
||||||
|
assertEquals("resource name wrong", resourceName, invitation.getResourceName());
|
||||||
|
assertEquals("role name wrong", inviteeRole, invitation.getRoleName());
|
||||||
|
assertEquals("server path wrong", serverPath, invitation.getServerPath());
|
||||||
|
assertEquals("accept URL wrong", acceptUrl, invitation.getAcceptUrl());
|
||||||
|
assertEquals("reject URL wrong", rejectUrl, invitation.getRejectUrl());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for the new invitation
|
||||||
|
*/
|
||||||
|
List<Invitation> invitations = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("invitations is empty", !invitations.isEmpty());
|
||||||
|
|
||||||
|
NominatedInvitation firstInvite = (NominatedInvitation)invitations.get(0);
|
||||||
|
assertEquals("invite id wrong", inviteId, firstInvite.getInviteId());
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, firstInvite.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, firstInvite.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, firstInvite.getInviteeUserName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now cancel the invitation
|
||||||
|
*/
|
||||||
|
NominatedInvitation canceledInvitation = (NominatedInvitation)invitationService.cancel(inviteId);
|
||||||
|
assertEquals("invite id wrong", inviteId, canceledInvitation.getInviteId());
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, canceledInvitation.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, canceledInvitation.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, canceledInvitation.getInviteeUserName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the query again - should no longer find anything
|
||||||
|
*/
|
||||||
|
List<Invitation> it2 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("invitations is not empty", it2.isEmpty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now invite and reject
|
||||||
|
*/
|
||||||
|
NominatedInvitation secondInvite = invitationService.inviteNominated(inviteeFirstName,
|
||||||
|
inviteeLastName,
|
||||||
|
inviteeEmail,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole,
|
||||||
|
serverPath,
|
||||||
|
acceptUrl,
|
||||||
|
rejectUrl) ;
|
||||||
|
|
||||||
|
NominatedInvitation rejectedInvitation = (NominatedInvitation)invitationService.cancel(secondInvite.getInviteId());
|
||||||
|
assertEquals("invite id wrong", secondInvite.getInviteId(), rejectedInvitation.getInviteId());
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, rejectedInvitation.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, rejectedInvitation.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, rejectedInvitation.getInviteeUserName());
|
||||||
|
|
||||||
|
List<Invitation> it3 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("invitations is not empty", it3.isEmpty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now invite and accept
|
||||||
|
*/
|
||||||
|
NominatedInvitation thirdInvite = invitationService.inviteNominated(inviteeFirstName,
|
||||||
|
inviteeLastName,
|
||||||
|
inviteeEmail,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole,
|
||||||
|
serverPath,
|
||||||
|
acceptUrl,
|
||||||
|
rejectUrl) ;
|
||||||
|
|
||||||
|
NominatedInvitation acceptedInvitation = (NominatedInvitation)invitationService.accept(thirdInvite.getInviteId(), thirdInvite.getTicket());
|
||||||
|
assertEquals("invite id wrong", thirdInvite.getInviteId(), acceptedInvitation.getInviteId());
|
||||||
|
assertEquals("first name wrong", inviteeFirstName, acceptedInvitation.getInviteeFirstName());
|
||||||
|
assertEquals("last name wrong", inviteeLastName, acceptedInvitation.getInviteeLastName());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, acceptedInvitation.getInviteeUserName());
|
||||||
|
|
||||||
|
List<Invitation> it4 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("invitations is not empty", it4.isEmpty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now verify access control list
|
||||||
|
*/
|
||||||
|
String roleName = siteService.getMembersRole(resourceName, inviteeUserName);
|
||||||
|
assertEquals("role name wrong", roleName, inviteeRole);
|
||||||
|
siteService.removeMembership(resourceName, inviteeUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a moderated invitation
|
||||||
|
* Get it
|
||||||
|
* Search for it
|
||||||
|
* Cancel it
|
||||||
|
*
|
||||||
|
* Create a moderated invitation
|
||||||
|
* Reject the invitation
|
||||||
|
*
|
||||||
|
* Create a moderated invitation
|
||||||
|
* Approve the invitation
|
||||||
|
*/
|
||||||
|
public void testModeratedInvitation()
|
||||||
|
{
|
||||||
|
String inviteeUserName = USER_TWO;
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String comments = "please sir, let me in!";
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
ModeratedInvitation invitation = invitationService.inviteModerated(comments,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
assertNotNull("moderated invitation is null", invitation);
|
||||||
|
String inviteId = invitation.getInviteId();
|
||||||
|
assertEquals("user name wrong", inviteeUserName, invitation.getInviteeUserName());
|
||||||
|
assertEquals("role name wrong", inviteeRole, invitation.getRoleName());
|
||||||
|
assertEquals("comments", comments, invitation.getInviteeComments());
|
||||||
|
assertEquals("resource type name wrong", resourceType, invitation.getResourceType());
|
||||||
|
assertEquals("resource name wrong", resourceName, invitation.getResourceName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now we have an invitation get it and check the details have been returned correctly.
|
||||||
|
*/
|
||||||
|
ModeratedInvitation mi2 = (ModeratedInvitation)invitationService.getInvitation(inviteId);
|
||||||
|
assertEquals("invite id", inviteId, mi2.getInviteId());
|
||||||
|
assertEquals("user name wrong", inviteeUserName, mi2.getInviteeUserName());
|
||||||
|
assertEquals("role name wrong", inviteeRole, mi2.getRoleName());
|
||||||
|
assertEquals("comments", comments, mi2.getInviteeComments());
|
||||||
|
assertEquals("resource type name wrong", resourceType, mi2.getResourceType());
|
||||||
|
assertEquals("resource name wrong", resourceName, mi2.getResourceName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for the new invitation
|
||||||
|
*/
|
||||||
|
List<Invitation> invitations = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("invitations is empty", !invitations.isEmpty());
|
||||||
|
|
||||||
|
ModeratedInvitation firstInvite = (ModeratedInvitation)invitations.get(0);
|
||||||
|
assertEquals("invite id wrong", inviteId, firstInvite.getInviteId());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel the invitation
|
||||||
|
*/
|
||||||
|
ModeratedInvitation canceledInvitation = (ModeratedInvitation)invitationService.cancel(inviteId);
|
||||||
|
assertEquals("invite id wrong", inviteId, canceledInvitation.getInviteId());
|
||||||
|
assertEquals("comments wrong", comments, canceledInvitation.getInviteeComments());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should now be no invitation
|
||||||
|
*/
|
||||||
|
List<Invitation> inv2 = invitationService.listPendingInvitationsForResource(resourceType, resourceName);
|
||||||
|
assertTrue("After cancel invitations is not empty", inv2.isEmpty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New invitation
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
ModeratedInvitation invite2 = invitationService.inviteModerated(comments,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
String secondInvite = invite2.getInviteId();
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
invitationService.reject(secondInvite, "This is a test reject");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New invitation
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
ModeratedInvitation invite3 = invitationService.inviteModerated(comments,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
String thirdInvite = invite3.getInviteId();
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
invitationService.approve(thirdInvite, "Welcome in");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now verify access control list
|
||||||
|
*/
|
||||||
|
String roleName = siteService.getMembersRole(resourceName, inviteeUserName);
|
||||||
|
assertEquals("role name wrong", roleName, inviteeRole);
|
||||||
|
siteService.removeMembership(resourceName, inviteeUserName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the approval of a moderated invitation
|
||||||
|
*/
|
||||||
|
public void testModeratedApprove()
|
||||||
|
{
|
||||||
|
String inviteeUserName = USER_TWO;
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String comments = "please sir, let me in!";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New invitation from User TWO
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
ModeratedInvitation invitation = invitationService.inviteModerated(comments,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
String invitationId = invitation.getInviteId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negative test
|
||||||
|
* Attempt to approve without the necessary role
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
invitationService.approve(invitationId, "No Way Hosea!");
|
||||||
|
assertTrue("excetion not thrown", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// An exception should have been thrown
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve the invitation
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
invitationService.approve(invitationId, "Come on in");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now verify access control list contains user two
|
||||||
|
*/
|
||||||
|
String roleName = siteService.getMembersRole(resourceName, inviteeUserName);
|
||||||
|
assertEquals("role name wrong", roleName, inviteeRole);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negative test
|
||||||
|
* attempt to approve an invitation that has aready been approved
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
invitationService.approve(invitationId, "Have I not already done this?");
|
||||||
|
assertTrue("duplicate approve excetion not thrown", false);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// An exception should have been thrown
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Negative test
|
||||||
|
* User is already a member of the site
|
||||||
|
*/
|
||||||
|
siteService.removeMembership(resourceName, inviteeUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests of Moderated Reject
|
||||||
|
*/
|
||||||
|
public void testModeratedReject()
|
||||||
|
{
|
||||||
|
String inviteeUserName = USER_TWO;
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String comments = "please sir, let me in!";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New invitation from User TWO
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_TWO);
|
||||||
|
ModeratedInvitation invitation = invitationService.inviteModerated(comments,
|
||||||
|
inviteeUserName,
|
||||||
|
resourceType,
|
||||||
|
resourceName,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
String invitationId = invitation.getInviteId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negative test
|
||||||
|
* Attempt to reject without the necessary role
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
invitationService.approve(invitationId, "No Way Hosea!");
|
||||||
|
assertTrue("excetion not thrown", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// An exception should have been thrown
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reject the invitation
|
||||||
|
*/
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
invitationService.approve(invitationId, "Go away!");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negative test
|
||||||
|
* attempt to approve an invitation that has been rejected
|
||||||
|
*/
|
||||||
|
try
|
||||||
|
{
|
||||||
|
invitationService.approve(invitationId, "Have I not rejected this?");
|
||||||
|
assertTrue("rejected invitation not working", false);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// An exception should have been thrown
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test search invitation
|
||||||
|
*/
|
||||||
|
public void testSearchInvitation()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Make up a tree of invitations and then search
|
||||||
|
*
|
||||||
|
* Resource, User, Workflow
|
||||||
|
* 1) RED, One, Moderated
|
||||||
|
* 2) RED, One, Nominated
|
||||||
|
* 3) BLUE, One, Nominated
|
||||||
|
* 4) RED, Two, Moderated
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||||
|
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||||
|
String comments = "please sir, let me in!";
|
||||||
|
String inviteeFirstName = PERSON_FIRSTNAME;
|
||||||
|
String inviteeLastName = PERSON_LASTNAME;
|
||||||
|
String inviteeEmail = "123";
|
||||||
|
String serverPath = "wibble";
|
||||||
|
String acceptUrl = "froob";
|
||||||
|
String rejectUrl = "marshmallow";
|
||||||
|
|
||||||
|
this.authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||||
|
ModeratedInvitation invitationOne = invitationService.inviteModerated(comments,
|
||||||
|
USER_ONE,
|
||||||
|
resourceType,
|
||||||
|
SITE_SHORT_NAME_RED,
|
||||||
|
inviteeRole);
|
||||||
|
|
||||||
|
String oneId = invitationOne.getInviteId();
|
||||||
|
NominatedInvitation invitationTwo = invitationService.inviteNominated(inviteeFirstName,
|
||||||
|
inviteeLastName,
|
||||||
|
inviteeEmail,
|
||||||
|
USER_ONE,
|
||||||
|
resourceType,
|
||||||
|
SITE_SHORT_NAME_RED,
|
||||||
|
inviteeRole,
|
||||||
|
serverPath,
|
||||||
|
acceptUrl,
|
||||||
|
rejectUrl) ;
|
||||||
|
String twoId = invitationTwo.getInviteId();
|
||||||
|
|
||||||
|
NominatedInvitation invitationThree = invitationService.inviteNominated(inviteeFirstName,
|
||||||
|
inviteeLastName,
|
||||||
|
inviteeEmail,
|
||||||
|
USER_ONE,
|
||||||
|
resourceType,
|
||||||
|
SITE_SHORT_NAME_BLUE,
|
||||||
|
inviteeRole,
|
||||||
|
serverPath,
|
||||||
|
acceptUrl,
|
||||||
|
rejectUrl) ;
|
||||||
|
String threeId = invitationThree.getInviteId();
|
||||||
|
|
||||||
|
ModeratedInvitation invitationFour = invitationService.inviteModerated(comments,
|
||||||
|
USER_TWO,
|
||||||
|
resourceType,
|
||||||
|
SITE_SHORT_NAME_RED,
|
||||||
|
inviteeRole);
|
||||||
|
String fourId = invitationFour.getInviteId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for invitations for BLUE
|
||||||
|
*/
|
||||||
|
List<Invitation> resOne = invitationService.listPendingInvitationsForResource(ResourceType.WEB_SITE, SITE_SHORT_NAME_BLUE);
|
||||||
|
assertEquals("blue invites not 1", 1, resOne.size());
|
||||||
|
assertEquals("blue id wrong", threeId, resOne.get(0).getInviteId());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for invitations for RED
|
||||||
|
*/
|
||||||
|
List<Invitation> resTwo = invitationService.listPendingInvitationsForResource(ResourceType.WEB_SITE, SITE_SHORT_NAME_RED);
|
||||||
|
assertEquals("red invites not 3", 3, resTwo.size());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for invitations for USER_ONE
|
||||||
|
*/
|
||||||
|
List<Invitation> resThree = invitationService.listPendingInvitationsForInvitee(USER_ONE);
|
||||||
|
assertEquals("user one does not have 3 invitations", 3, resThree.size());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for invitations for USER_TWO
|
||||||
|
*/
|
||||||
|
List<Invitation> resFour = invitationService.listPendingInvitationsForInvitee(USER_TWO);
|
||||||
|
assertEquals("user two does not have 1 invitations", 1, resFour.size());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for user1's nominated invitations
|
||||||
|
*/
|
||||||
|
InvitationSearchCriteriaImpl crit1 = new InvitationSearchCriteriaImpl();
|
||||||
|
crit1.setInvitee(USER_ONE);
|
||||||
|
crit1.setInvitationType(InvitationSearchCriteria.InvitationType.NOMINATED);
|
||||||
|
|
||||||
|
List<Invitation> resFive = invitationService.searchInvitation(crit1);
|
||||||
|
assertEquals("user one does not have 2 nominated", 2, resFive.size());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negative test - search with an empty criteria
|
||||||
|
*/
|
||||||
|
InvitationSearchCriteria crit2 = new InvitationSearchCriteriaImpl();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<Invitation> resSix = invitationService.searchInvitation(crit2);
|
||||||
|
assertTrue("exception not thrown", false);
|
||||||
|
}
|
||||||
|
catch (InvitationExceptionUserError e)
|
||||||
|
{
|
||||||
|
// Should go here - no criteria
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testGetInvitation()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get an invitation that does not exist.
|
||||||
|
*/
|
||||||
|
invitationService.getInvitation("jbpm$99999999");
|
||||||
|
fail("should have thrown an exception");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createPerson(String userName, String emailAddress)
|
||||||
|
{
|
||||||
|
// if user with given user name doesn't already exist then create user
|
||||||
|
if (this.authenticationService.authenticationExists(userName) == false)
|
||||||
|
{
|
||||||
|
// create user
|
||||||
|
this.authenticationService.createAuthentication(userName,
|
||||||
|
"password".toCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if person node with given user name doesn't already exist then create
|
||||||
|
// person
|
||||||
|
if (this.personService.personExists(userName) == false)
|
||||||
|
{
|
||||||
|
// create person properties
|
||||||
|
PropertyMap personProps = new PropertyMap();
|
||||||
|
personProps.put(ContentModel.PROP_USERNAME, userName);
|
||||||
|
personProps.put(ContentModel.PROP_FIRSTNAME, PERSON_FIRSTNAME);
|
||||||
|
personProps.put(ContentModel.PROP_LASTNAME, PERSON_LASTNAME);
|
||||||
|
personProps.put(ContentModel.PROP_EMAIL, emailAddress);
|
||||||
|
personProps.put(ContentModel.PROP_JOBTITLE, PERSON_JOBTITLE);
|
||||||
|
personProps.put(ContentModel.PROP_ORGANIZATION, PERSON_ORG);
|
||||||
|
|
||||||
|
// create person node for user
|
||||||
|
this.personService.createPerson(personProps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deletePersonByUserName(String userName)
|
||||||
|
{
|
||||||
|
// delete authentication if authentication exists for given user name
|
||||||
|
if (this.authenticationService.authenticationExists(userName))
|
||||||
|
{
|
||||||
|
this.authenticationService.deleteAuthentication(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete user account
|
||||||
|
if (this.mutableAuthenticationDao.userExists(userName))
|
||||||
|
{
|
||||||
|
this.mutableAuthenticationDao.deleteUser(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete person node associated with given user name
|
||||||
|
// if one exists
|
||||||
|
if (this.personService.personExists(userName))
|
||||||
|
{
|
||||||
|
this.personService.deletePerson(userName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.ModeratedInvitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation.ResourceType;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InvitationRequestImpl is a basic InvitationRequest that is processed by the
|
||||||
|
* InvitationService
|
||||||
|
*/
|
||||||
|
/*package scope */ class ModeratedInvitationImpl extends InvitationImpl implements ModeratedInvitation, Serializable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5557544865169876451L;
|
||||||
|
|
||||||
|
private String roleName;
|
||||||
|
private String inviteeComments;
|
||||||
|
|
||||||
|
public ModeratedInvitationImpl()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModeratedInvitationImpl(Map<QName, Serializable> workflowProps)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
setInviteeUserName((String)workflowProps.get(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_USER_NAME));
|
||||||
|
setResourceName((String)workflowProps.get(WorkflowModelModeratedInvitation.WF_PROP_RESOURCE_NAME));
|
||||||
|
if(workflowProps.containsKey(WorkflowModelModeratedInvitation.WF_PROP_RESOURCE_TYPE))
|
||||||
|
{
|
||||||
|
setResourceType(ResourceType.valueOf((String)workflowProps.get(WorkflowModelModeratedInvitation.WF_PROP_RESOURCE_TYPE)));
|
||||||
|
}
|
||||||
|
roleName = (String)workflowProps.get(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_ROLE);
|
||||||
|
inviteeComments = (String)workflowProps.get(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_COMMENTS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setRoleName(String roleName)
|
||||||
|
{
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName()
|
||||||
|
{
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInviteeComments()
|
||||||
|
{
|
||||||
|
return inviteeComments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteeComments(String inviteeComments)
|
||||||
|
{
|
||||||
|
this.inviteeComments = inviteeComments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Moderated Invitation Process has a moderator who approves or rejects
|
||||||
|
* invitations raised by the invitee themselves.
|
||||||
|
*
|
||||||
|
* Upon approval the invitee will be given the requested role for the
|
||||||
|
* requested resource.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ModeratedInvitationProcess extends InvitationProcess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Invitee kicks off process
|
||||||
|
* @param request
|
||||||
|
* @param reason
|
||||||
|
*/
|
||||||
|
public Invitation invite(Invitation request, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moderator approves this request
|
||||||
|
* @param request the request to approve.
|
||||||
|
*/
|
||||||
|
public void approve(Invitation request, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moderator rejects this request
|
||||||
|
* @param request the request to reject
|
||||||
|
*/
|
||||||
|
public void reject(Invitation request, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invitee cancels this request
|
||||||
|
*/
|
||||||
|
public void cancel (Invitation request, String reason);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.repo.workflow.WorkflowModel;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
import org.alfresco.service.cmr.invitation.NominatedInvitation;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NominatedInvitationImpl is a basic Nominated Invitation Request that
|
||||||
|
* is processed by the InvitationService.
|
||||||
|
*
|
||||||
|
* @see org.alfresco.service.cmr.invitation.NominatedInvitation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*package scope */ class NominatedInvitationImpl extends InvitationImpl implements NominatedInvitation, Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8800842866845149466L;
|
||||||
|
private String inviteeFirstName;
|
||||||
|
private String inviteeLastName;
|
||||||
|
private String inviteeEmail;
|
||||||
|
private String roleName;
|
||||||
|
private String serverPath;
|
||||||
|
private String acceptUrl;
|
||||||
|
private String rejectUrl;
|
||||||
|
private Date sentInviteDate;
|
||||||
|
private String ticket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a new nominated invitation
|
||||||
|
*/
|
||||||
|
public NominatedInvitationImpl()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NominatedInvitationImpl(Map<QName, Serializable> workflowProps)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
setInviteeUserName((String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_USER_NAME));
|
||||||
|
inviteeFirstName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_FIRSTNAME);
|
||||||
|
inviteeLastName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_LASTNAME);
|
||||||
|
// inviteePassword = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_GEN_PASSWORD);
|
||||||
|
setResourceName( (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME));
|
||||||
|
|
||||||
|
if(workflowProps.containsKey(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_TYPE))
|
||||||
|
{
|
||||||
|
setResourceType(ResourceType.valueOf((String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_TYPE)));
|
||||||
|
}
|
||||||
|
roleName = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_SITE_ROLE);
|
||||||
|
serverPath = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_SERVER_PATH);
|
||||||
|
acceptUrl = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_ACCEPT_URL);
|
||||||
|
rejectUrl = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_REJECT_URL);
|
||||||
|
ticket = (String)workflowProps.get(WorkflowModelNominatedInvitation.WF_PROP_INVITE_TICKET);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteeFirstName(String inviteeFirstName) {
|
||||||
|
this.inviteeFirstName = inviteeFirstName;
|
||||||
|
}
|
||||||
|
public String getInviteeFirstName() {
|
||||||
|
return inviteeFirstName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteeLastName(String inviteeLastName) {
|
||||||
|
this.inviteeLastName = inviteeLastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInviteeLastName() {
|
||||||
|
return inviteeLastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInviteeEmail(String inviteeEmail) {
|
||||||
|
this.inviteeEmail = inviteeEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInviteeEmail() {
|
||||||
|
return inviteeEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServerPath(String serverPath) {
|
||||||
|
this.serverPath = serverPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServerPath() {
|
||||||
|
return serverPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcceptUrl(String acceptUrl) {
|
||||||
|
this.acceptUrl = acceptUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAcceptUrl() {
|
||||||
|
return acceptUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRejectUrl(String rejectUrl) {
|
||||||
|
this.rejectUrl = rejectUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRejectUrl() {
|
||||||
|
return rejectUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSentInviteDate(Date sentInviteDate) {
|
||||||
|
this.sentInviteDate = sentInviteDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSentInviteDate() {
|
||||||
|
return sentInviteDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(String ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Invitation process is the interface provided by the invitation service to be
|
||||||
|
* implemented by each resource handler
|
||||||
|
*
|
||||||
|
* This invitation process is where someone nominates an invitee who then needs to accept or
|
||||||
|
* reject the nomination.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface NominatedInvitationProcess extends InvitationProcess
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* inviter starts the invitation process
|
||||||
|
*/
|
||||||
|
public Invitation invite(Invitation request, String comment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* invitee accepts this request
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
public void accept(Invitation request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* invitee rejects this request
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
public void reject(Invitation request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cancel this request
|
||||||
|
*/
|
||||||
|
public void cancel (Invitation request);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,73 @@
|
|||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workflow Model for a Moderated Invitation
|
||||||
|
*/
|
||||||
|
public interface WorkflowModelModeratedInvitation {
|
||||||
|
|
||||||
|
// process name
|
||||||
|
public static final QName WF_PROCESS_INVITATION_MODERATED = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "invitation-moderated");
|
||||||
|
|
||||||
|
// workflow definition name
|
||||||
|
public static final String WORKFLOW_DEFINITION_NAME = "jbpm$wf:invitation-moderated";
|
||||||
|
|
||||||
|
// tasks
|
||||||
|
public static final QName WF_START_TASK = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "moderatedInvitationSubmitTask");
|
||||||
|
public static final QName WF_REVIEW_TASK = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI,"moderatedInvitationReviewTask");
|
||||||
|
|
||||||
|
// associations
|
||||||
|
static final QName ASSOC_GROUP_ASSIGNEE = QName.createQName(NamespaceService.BPM_MODEL_1_0_URI, "groupAssignee");
|
||||||
|
|
||||||
|
// transition names
|
||||||
|
public static final String WF_TRANSITION_REVIEW = "review";
|
||||||
|
public static final String WF_TRANSITION_APPROVE = "approve";
|
||||||
|
public static final String WF_TRANSITION_REJECT = "reject";
|
||||||
|
public static final String WF_TRANSITION_CANCEL = "cancel";
|
||||||
|
public static final String WF_TRANSITION_END = "end";
|
||||||
|
|
||||||
|
// workflow properties
|
||||||
|
public static final QName WF_PROP_INVITEE_USER_NAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeUserName");
|
||||||
|
public static final QName WF_PROP_INVITEE_ROLE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeRole");
|
||||||
|
public static final QName WF_PROP_INVITEE_COMMENTS = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeComments");
|
||||||
|
public static final QName WF_PROP_RESOURCE_NAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "resourceName");
|
||||||
|
public static final QName WF_PROP_RESOURCE_TYPE= QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "resourceType");
|
||||||
|
public static final QName WF_PROP_REVIEW_COMMENTS= QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "reviewComments");
|
||||||
|
public static final QName WF_PROP_REVIEWER= QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "reviewer");
|
||||||
|
|
||||||
|
// workflow execution context variable names
|
||||||
|
public static final String wfVarInviteeUserName = "wf_inviteeUserName";
|
||||||
|
public static final String wfVarInviteeRole = "wf_inviteeRole";
|
||||||
|
public static final String wfVarWorkflowInstanceId = "workflowinstanceid";
|
||||||
|
public static final String wfVarResourceName = "wf_resourceName";
|
||||||
|
public static final String wfVarResourceType = "wf_resourceType";
|
||||||
|
public static final String wfVarReviewer = "wf_reviewer";
|
||||||
|
public static final String wfVarReviewComments = "wf_reviewComments";
|
||||||
|
}
|
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.repo.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workflow Model for a Nominated Invitation
|
||||||
|
*/
|
||||||
|
public interface WorkflowModelNominatedInvitation {
|
||||||
|
|
||||||
|
// process name
|
||||||
|
public static final QName WF_PROCESS_INVITE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "invite");
|
||||||
|
|
||||||
|
// workflow definition name
|
||||||
|
public static final String WORKFLOW_DEFINITION_NAME = "jbpm$wf:invite";
|
||||||
|
|
||||||
|
// tasks
|
||||||
|
public static final QName WF_INVITE_TASK_INVITE_TO_SITE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteToSiteTask");
|
||||||
|
public static final QName WF_INVITE_TASK_INVITE_PENDING = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "invitePendingTask");
|
||||||
|
public static final QName WF_TASK_ACCEPT_INVITE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "acceptInviteTask");
|
||||||
|
public static final QName WF_TASK_REJECT_INVITE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "rejectInviteTask");
|
||||||
|
|
||||||
|
// transition names
|
||||||
|
public static final String WF_TRANSITION_SEND_INVITE = "sendInvite";
|
||||||
|
public static final String WF_TRANSITION_ACCEPT = "accept";
|
||||||
|
public static final String WF_TRANSITION_REJECT = "reject";
|
||||||
|
public static final String WF_TRANSITION_CANCEL = "cancel";
|
||||||
|
public static final String WF_TRANSITION_ACCEPT_INVITE_END = "end";
|
||||||
|
public static final String WF_TRANSITION_REJECT_INVITE_END = "end";
|
||||||
|
|
||||||
|
// workflow properties
|
||||||
|
public static final QName WF_PROP_SERVER_PATH = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "serverPath");
|
||||||
|
public static final QName WF_PROP_ACCEPT_URL = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "acceptUrl");
|
||||||
|
public static final QName WF_PROP_REJECT_URL = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "rejectUrl");
|
||||||
|
public static final QName WF_PROP_INVITE_TICKET = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteTicket");
|
||||||
|
public static final QName WF_PROP_INVITER_USER_NAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviterUserName");
|
||||||
|
public static final QName WF_PROP_INVITEE_USER_NAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeUserName");
|
||||||
|
public static final QName WF_PROP_INVITEE_FIRSTNAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeFirstName");
|
||||||
|
public static final QName WF_PROP_INVITEE_LASTNAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeLastName");
|
||||||
|
public static final QName WF_PROP_RESOURCE_TYPE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "resourceType");
|
||||||
|
public static final QName WF_PROP_RESOURCE_NAME = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "resourceName");
|
||||||
|
public static final QName WF_PROP_INVITEE_SITE_ROLE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeSiteRole");
|
||||||
|
public static final QName WF_PROP_SENT_INVITE_DATE = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "sentInviteDate");
|
||||||
|
public static final QName WF_PROP_INVITEE_GEN_PASSWORD = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "inviteeGenPassword");
|
||||||
|
|
||||||
|
// workflow execution context variable names
|
||||||
|
public static final String wfVarInviteeUserName = "wf_inviteeUserName";
|
||||||
|
public static final String wfVarInviterUserName = "wf_inviterUserName";
|
||||||
|
public static final String wfVarResourceName = "wf_resourceName";
|
||||||
|
public static final String wfVarResourceType = "wf_resourceType";
|
||||||
|
public static final String wfVarWorkflowInstanceId = "workflowinstanceid";
|
||||||
|
public static final String wfVarRole = "wf_inviteeSiteRole";
|
||||||
|
|
||||||
|
}
|
6
source/java/org/alfresco/repo/invitation/package.html
Normal file
6
source/java/org/alfresco/repo/invitation/package.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
The implementation of the Invitation Service.
|
||||||
|
|
||||||
|
Which deals with invitations to private and moderated resources.
|
||||||
|
|
||||||
|
@see org.alfresco.service.cmr.invitation.InvitationService
|
||||||
|
|
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains logic that gets executed when
|
||||||
|
* the wf:invitePendingTask in the invite workflow gets completed
|
||||||
|
* along the "accept" transition
|
||||||
|
*
|
||||||
|
* @author glen johnson at alfresco com
|
||||||
|
*/
|
||||||
|
public class AcceptInviteAction extends JBPMSpringActionHandler
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 8133039174866049136L;
|
||||||
|
|
||||||
|
private SiteService siteService;
|
||||||
|
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler#initialiseHandler(org.springframework.beans.factory.BeanFactory)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initialiseHandler(BeanFactory factory)
|
||||||
|
{
|
||||||
|
ServiceRegistry services = (ServiceRegistry)factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
|
mutableAuthenticationDao = (MutableAuthenticationDao) factory.getBean("authenticationDao");
|
||||||
|
siteService = services.getSiteService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void execute(final ExecutionContext executionContext) throws Exception
|
||||||
|
{
|
||||||
|
final String inviteeUserName = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||||
|
final String siteShortName = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarResourceName);
|
||||||
|
final String inviterUserName = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarInviterUserName);
|
||||||
|
final String inviteeSiteRole = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarRole);
|
||||||
|
|
||||||
|
// if there is already a user account for the invitee and that account
|
||||||
|
// is disabled, then enable the account because he/she has accepted the
|
||||||
|
// site invitation
|
||||||
|
if ((this.mutableAuthenticationDao.userExists(inviteeUserName))
|
||||||
|
&& (this.mutableAuthenticationDao.getEnabled(inviteeUserName) == false))
|
||||||
|
{
|
||||||
|
this.mutableAuthenticationDao.setEnabled(inviteeUserName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add Invitee to Site with the site role that the inviter "started" the invite process with
|
||||||
|
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
AcceptInviteAction.this.siteService.setMembership(siteShortName,
|
||||||
|
inviteeUserName, inviteeSiteRole);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, inviterUserName);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.site.SiteModel;
|
||||||
|
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationExceptionForbidden;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains logic that gets executed when
|
||||||
|
* the wf:invitePendingTask in the invite workflow gets cancelled
|
||||||
|
* along the "cancel" transition
|
||||||
|
*
|
||||||
|
* @author glen johnson at alfresco com
|
||||||
|
*/
|
||||||
|
public class CancelInviteAction extends JBPMSpringActionHandler
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 776961141883350908L;
|
||||||
|
|
||||||
|
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||||
|
private PersonService personService;
|
||||||
|
private WorkflowService workflowService;
|
||||||
|
private SiteService siteService;
|
||||||
|
|
||||||
|
private final String MSG_NOT_SITE_MANAGER = "invitation.cancel.not_site_manager";
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler#initialiseHandler(org.springframework.beans.factory.BeanFactory)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initialiseHandler(BeanFactory factory)
|
||||||
|
{
|
||||||
|
ServiceRegistry services = (ServiceRegistry)factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
|
mutableAuthenticationDao = (MutableAuthenticationDao) factory.getBean("authenticationDao");
|
||||||
|
personService = (PersonService) services.getPersonService();
|
||||||
|
workflowService = (WorkflowService) services.getWorkflowService();
|
||||||
|
siteService = (SiteService) services.getSiteService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void execute(final ExecutionContext executionContext) throws Exception
|
||||||
|
{
|
||||||
|
// get the invitee user name and site short name variables off the execution context
|
||||||
|
final String inviteeUserName = (String) executionContext.getVariable(
|
||||||
|
WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||||
|
final String siteShortName = (String) executionContext.getVariable(
|
||||||
|
WorkflowModelNominatedInvitation.wfVarResourceName);
|
||||||
|
final String inviteId = (String) executionContext.getVariable(
|
||||||
|
WorkflowModelNominatedInvitation.wfVarWorkflowInstanceId);
|
||||||
|
|
||||||
|
String currentUserName = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||||
|
String currentUserSiteRole = this.siteService.getMembersRole(siteShortName, currentUserName);
|
||||||
|
if ((currentUserSiteRole == null) || (currentUserSiteRole.equals(SiteModel.SITE_MANAGER) == false))
|
||||||
|
{
|
||||||
|
// The current user is not the site manager
|
||||||
|
Object[] args = {currentUserName, inviteId, siteShortName};
|
||||||
|
throw new InvitationExceptionForbidden(MSG_NOT_SITE_MANAGER, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up invitee's user account and person node if they are not in use i.e.
|
||||||
|
// account is still disabled and there are no pending invites outstanding for the
|
||||||
|
// invitee
|
||||||
|
InviteHelper.cleanUpStaleInviteeResources(inviteeUserName, mutableAuthenticationDao, personService,
|
||||||
|
workflowService);
|
||||||
|
}
|
||||||
|
}
|
269
source/java/org/alfresco/repo/invitation/site/InviteHelper.java
Normal file
269
source/java/org/alfresco/repo/invitation/site/InviteHelper.java
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.template.TemplateNode;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowTaskQuery;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to house utility methods common to
|
||||||
|
* more than one Invite Service Web Script
|
||||||
|
*/
|
||||||
|
public class InviteHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Find an invite start task by the given task id.
|
||||||
|
*
|
||||||
|
* @return a WorkflowTask or null if not found.
|
||||||
|
*/
|
||||||
|
public static WorkflowTask findInviteStartTask(String inviteId, WorkflowService workflowService)
|
||||||
|
{
|
||||||
|
// create workflow task query
|
||||||
|
WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
|
||||||
|
|
||||||
|
wfTaskQuery.setProcessId(inviteId);
|
||||||
|
|
||||||
|
// set process name to "wf:invite" so that only tasks associated with
|
||||||
|
// invite workflow instances are returned by query
|
||||||
|
wfTaskQuery.setProcessName(QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "invite"));
|
||||||
|
|
||||||
|
// filter to find only the invite start task
|
||||||
|
wfTaskQuery.setTaskState(WorkflowTaskState.COMPLETED);
|
||||||
|
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_TO_SITE);
|
||||||
|
|
||||||
|
// query for invite workflow task associate
|
||||||
|
List<WorkflowTask> inviteStartTasks = workflowService
|
||||||
|
.queryTasks(wfTaskQuery);
|
||||||
|
|
||||||
|
// should also be 0 or 1
|
||||||
|
if (inviteStartTasks.size() < 1)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return inviteStartTasks.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find invitePending tasks (in-progress) by the given invitee user name
|
||||||
|
*
|
||||||
|
* @return a list of workflow tasks
|
||||||
|
*/
|
||||||
|
public static List<WorkflowTask> findInvitePendingTasks(String inviteeUserName, WorkflowService workflowService)
|
||||||
|
{
|
||||||
|
// create workflow task query
|
||||||
|
WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
|
||||||
|
|
||||||
|
// set process name to "wf:invite" so that only tasks associated with
|
||||||
|
// invite workflow instances are returned by query
|
||||||
|
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
||||||
|
|
||||||
|
// set query to only pick up invite workflow instances
|
||||||
|
// associated with the given invitee user name
|
||||||
|
Map<QName, Object> processCustomProps = new HashMap<QName, Object>(1, 1.0f);
|
||||||
|
processCustomProps.put(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_USER_NAME, inviteeUserName);
|
||||||
|
wfTaskQuery.setProcessCustomProps(processCustomProps);
|
||||||
|
|
||||||
|
// set query to only pick up in-progress invite pending tasks
|
||||||
|
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
|
||||||
|
wfTaskQuery.setTaskName(WorkflowModelNominatedInvitation.WF_INVITE_TASK_INVITE_PENDING);
|
||||||
|
|
||||||
|
// query for invite workflow task associate
|
||||||
|
List<WorkflowTask> inviteStartTasks = workflowService
|
||||||
|
.queryTasks(wfTaskQuery);
|
||||||
|
|
||||||
|
return inviteStartTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an InviteInfo instance for the given startInvite task
|
||||||
|
* (used for rendering the response).
|
||||||
|
*
|
||||||
|
* @param startInviteTask startInvite task to get invite info properties from
|
||||||
|
* @param serviceRegistry service registry instance
|
||||||
|
* @param siteService site service instance
|
||||||
|
*
|
||||||
|
* @return InviteInfo instance containing invite information
|
||||||
|
*/
|
||||||
|
public static InviteInfo getPendingInviteInfo(final WorkflowTask startInviteTask,
|
||||||
|
final ServiceRegistry serviceRegistry, final SiteService siteService)
|
||||||
|
{
|
||||||
|
final PersonService personService = serviceRegistry.getPersonService();
|
||||||
|
|
||||||
|
// get the inviter, invitee, role and site short name
|
||||||
|
final String inviterUserNameProp = (String) startInviteTask.properties.get(
|
||||||
|
WorkflowModelNominatedInvitation.WF_PROP_INVITER_USER_NAME);
|
||||||
|
final String inviteeUserNameProp = (String) startInviteTask.properties.get(
|
||||||
|
WorkflowModelNominatedInvitation.WF_PROP_INVITEE_USER_NAME);
|
||||||
|
final String role = (String) startInviteTask.properties.get(
|
||||||
|
WorkflowModelNominatedInvitation.WF_PROP_INVITEE_SITE_ROLE);
|
||||||
|
final String siteShortNameProp = (String) startInviteTask.properties.get(
|
||||||
|
WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_NAME);
|
||||||
|
|
||||||
|
// get the site info
|
||||||
|
SiteInfo siteInfo = siteService.getSite(siteShortNameProp);
|
||||||
|
|
||||||
|
// get workflow instance id (associated with workflow task) to place
|
||||||
|
// as "inviteId" onto model
|
||||||
|
String workflowId = startInviteTask.path.instance.id;
|
||||||
|
|
||||||
|
// set the invite start date to the time the workflow instance
|
||||||
|
// (associated with the task) was started
|
||||||
|
Date sentInviteDate = startInviteTask.path.instance.startDate;
|
||||||
|
|
||||||
|
// TODO: glen johnson at alfresco com - as this web script only returns
|
||||||
|
// pending invites, this is hard coded to "pending" for now
|
||||||
|
String invitationStatus = InviteInfo.INVITATION_STATUS_PENDING;
|
||||||
|
|
||||||
|
// fetch the person node for the inviter
|
||||||
|
NodeRef inviterRef = personService.getPerson(inviterUserNameProp);
|
||||||
|
TemplateNode inviterPerson = null;
|
||||||
|
if (inviterRef != null)
|
||||||
|
{
|
||||||
|
inviterPerson = new TemplateNode(inviterRef, serviceRegistry, null);
|
||||||
|
//inviterPerson = new ScriptNode(inviterRef, serviceRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetch the person node for the invitee
|
||||||
|
NodeRef inviteeRef = personService.getPerson(inviteeUserNameProp);
|
||||||
|
TemplateNode inviteePerson = null;
|
||||||
|
if (inviteeRef != null)
|
||||||
|
{
|
||||||
|
inviteePerson = new TemplateNode(inviteeRef, serviceRegistry, null);
|
||||||
|
//inviteePerson = new ScriptNode(inviteeRef, serviceRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create and return a invite info
|
||||||
|
InviteInfo inviteInfo = new InviteInfo(invitationStatus, inviterUserNameProp, inviterPerson,
|
||||||
|
inviteeUserNameProp, inviteePerson, role, siteShortNameProp, siteInfo, sentInviteDate, workflowId);
|
||||||
|
|
||||||
|
return inviteInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up invitee user account and person node when no longer in use.
|
||||||
|
* They are deemed to no longer be in use when the invitee user account
|
||||||
|
* is still disabled and there are no outstanding pending invites for that invitee.
|
||||||
|
*
|
||||||
|
* @param inviteeUserName
|
||||||
|
* @param authenticationDao
|
||||||
|
* @param personService
|
||||||
|
* @param workflowService
|
||||||
|
*/
|
||||||
|
public static void cleanUpStaleInviteeResources(final String inviteeUserName,
|
||||||
|
final MutableAuthenticationDao authenticationDao, final PersonService personService,
|
||||||
|
final WorkflowService workflowService)
|
||||||
|
{
|
||||||
|
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
// see if there are any pending invites (invite workflow instances with invitePending task in-progress)
|
||||||
|
// outstanding for given invitee user name
|
||||||
|
List<WorkflowTask> pendingTasks = InviteHelper.findInvitePendingTasks(inviteeUserName, workflowService);
|
||||||
|
boolean invitesPending = (pendingTasks != null) && (pendingTasks.size() > 0);
|
||||||
|
|
||||||
|
// if invitee's user account is still disabled and there are no pending invites outstanding
|
||||||
|
// for the invitee, then remove the account and delete the invitee's person node
|
||||||
|
if ((authenticationDao.userExists(inviteeUserName))
|
||||||
|
&& (authenticationDao.getEnabled(inviteeUserName) == false)
|
||||||
|
&& (invitesPending == false))
|
||||||
|
{
|
||||||
|
// delete the invitee's user account
|
||||||
|
authenticationDao.deleteUser(inviteeUserName);
|
||||||
|
|
||||||
|
// delete the invitee's person node if one exists
|
||||||
|
if (personService.personExists(inviteeUserName))
|
||||||
|
{
|
||||||
|
personService.deletePerson(inviteeUserName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complete the specified Invite Workflow Task for the invite workflow
|
||||||
|
* instance associated with the given invite ID, and follow the given
|
||||||
|
* transition upon completing the task
|
||||||
|
*
|
||||||
|
* @param inviteId the invite ID of the invite workflow instance for which
|
||||||
|
* we want to complete the given task
|
||||||
|
* @param fullTaskName qualified name of invite workflow task to complete
|
||||||
|
* @param transitionId the task transition to take on completion of
|
||||||
|
* the task (or null, for the default transition)
|
||||||
|
*/
|
||||||
|
public static void completeInviteTask(String inviteId, QName fullTaskName, String transitionId,
|
||||||
|
final WorkflowService workflowService)
|
||||||
|
{
|
||||||
|
// create workflow task query
|
||||||
|
WorkflowTaskQuery wfTaskQuery = new WorkflowTaskQuery();
|
||||||
|
|
||||||
|
// set the given invite ID as the workflow process ID in the workflow query
|
||||||
|
wfTaskQuery.setProcessId(inviteId);
|
||||||
|
|
||||||
|
// find incomplete invite workflow tasks with given task name
|
||||||
|
wfTaskQuery.setActive(Boolean.TRUE);
|
||||||
|
wfTaskQuery.setTaskState(WorkflowTaskState.IN_PROGRESS);
|
||||||
|
wfTaskQuery.setTaskName(fullTaskName);
|
||||||
|
|
||||||
|
// set process name to "wf:invite" so that only
|
||||||
|
// invite workflow instances are considered by this query
|
||||||
|
wfTaskQuery.setProcessName(WorkflowModelNominatedInvitation.WF_PROCESS_INVITE);
|
||||||
|
|
||||||
|
// query for invite workflow tasks with the constructed query
|
||||||
|
List<WorkflowTask> wf_invite_tasks = workflowService
|
||||||
|
.queryTasks(wfTaskQuery);
|
||||||
|
|
||||||
|
// end all tasks found with this name
|
||||||
|
for (WorkflowTask workflowTask : wf_invite_tasks)
|
||||||
|
{
|
||||||
|
workflowService.endTask(workflowTask.id, transitionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
171
source/java/org/alfresco/repo/invitation/site/InviteInfo.java
Normal file
171
source/java/org/alfresco/repo/invitation/site/InviteInfo.java
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.alfresco.repo.template.TemplateNode;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds properties pertaining to an invitation that has been sent out by a Site Manager (Inviter)
|
||||||
|
* to another person (Invitee) to join his/her Site
|
||||||
|
*
|
||||||
|
* @author glen dot johnson at alfresco dot com
|
||||||
|
*/
|
||||||
|
public class InviteInfo implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -4514253998906200208L;
|
||||||
|
|
||||||
|
// invitation statuses
|
||||||
|
public static final String INVITATION_STATUS_PENDING = "pending";
|
||||||
|
public static final String INVITATION_STATUS_ACCEPTED = "accepted";
|
||||||
|
public static final String INVITATION_STATUS_REJECTED = "rejected";
|
||||||
|
|
||||||
|
// private instances to hold property values
|
||||||
|
private String invitationStatus;
|
||||||
|
private String inviterUserName;
|
||||||
|
private TemplateNode inviterPerson;
|
||||||
|
private String inviteeUserName;
|
||||||
|
private TemplateNode inviteePerson;
|
||||||
|
private String role;
|
||||||
|
private String siteShortName;
|
||||||
|
private SiteInfo siteInfo;
|
||||||
|
private Date sentInviteDate;
|
||||||
|
private String inviteId;
|
||||||
|
|
||||||
|
public InviteInfo(String invitationStatus, String inviterUserName, TemplateNode inviterPerson,
|
||||||
|
String inviteeUserName, TemplateNode inviteePerson, String role,
|
||||||
|
String siteShortName, SiteInfo siteInfo, Date sentInviteDate, String inviteId)
|
||||||
|
{
|
||||||
|
this.invitationStatus = invitationStatus;
|
||||||
|
this.inviterUserName = inviterUserName;
|
||||||
|
this.inviterPerson = inviterPerson;
|
||||||
|
this.inviteeUserName = inviteeUserName;
|
||||||
|
this.inviteePerson = inviteePerson;
|
||||||
|
this.role = role;
|
||||||
|
this.siteShortName = siteShortName;
|
||||||
|
this.siteInfo = siteInfo;
|
||||||
|
this.sentInviteDate = sentInviteDate;
|
||||||
|
this.inviteId = inviteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the inviter user name
|
||||||
|
*
|
||||||
|
* @return the inviterUserName
|
||||||
|
*/
|
||||||
|
public String getInviterUserName()
|
||||||
|
{
|
||||||
|
return inviterUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the invitee user name
|
||||||
|
*
|
||||||
|
* @return the inviteeUserName
|
||||||
|
*/
|
||||||
|
public String getInviteeUserName()
|
||||||
|
{
|
||||||
|
return inviteeUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the site short name
|
||||||
|
*
|
||||||
|
* @return the siteShortName
|
||||||
|
*/
|
||||||
|
public String getSiteShortName()
|
||||||
|
{
|
||||||
|
return siteShortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the invite ID
|
||||||
|
*
|
||||||
|
* @return the inviteId
|
||||||
|
*/
|
||||||
|
public String getInviteId()
|
||||||
|
{
|
||||||
|
return inviteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the invitee person
|
||||||
|
*
|
||||||
|
* @return the invitee person
|
||||||
|
*/
|
||||||
|
public TemplateNode getInviteePerson()
|
||||||
|
{
|
||||||
|
return inviteePerson;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the inviter person
|
||||||
|
*
|
||||||
|
* @return the inviter person
|
||||||
|
*/
|
||||||
|
public TemplateNode getInviterPerson()
|
||||||
|
{
|
||||||
|
return inviterPerson;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sent invite date
|
||||||
|
*
|
||||||
|
* @return the sent invite date
|
||||||
|
*/
|
||||||
|
public Date getSentInviteDate()
|
||||||
|
{
|
||||||
|
return sentInviteDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the invitation status
|
||||||
|
*
|
||||||
|
* @return the invitation status
|
||||||
|
*/
|
||||||
|
public String getInvitationStatus()
|
||||||
|
{
|
||||||
|
return invitationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the role that invitee has been invited to the site as
|
||||||
|
*
|
||||||
|
* @return the role that the invitee has been invited to the site as
|
||||||
|
*/
|
||||||
|
public String getRole()
|
||||||
|
{
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SiteInfo getSiteInfo()
|
||||||
|
{
|
||||||
|
return siteInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have received a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
|
||||||
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
|
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains logic that gets executed when
|
||||||
|
* the wf:invitePendingTask in the invite workflow gets completed
|
||||||
|
* along the "reject" transition
|
||||||
|
*
|
||||||
|
* @author glen johnson at alfresco com
|
||||||
|
*/
|
||||||
|
public class RejectInviteAction extends JBPMSpringActionHandler
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 4377660284993206875L;
|
||||||
|
|
||||||
|
private MutableAuthenticationDao mutableAuthenticationDao;
|
||||||
|
private PersonService personService;
|
||||||
|
private WorkflowService workflowService;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler#initialiseHandler(org.springframework.beans.factory.BeanFactory)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initialiseHandler(BeanFactory factory)
|
||||||
|
{
|
||||||
|
ServiceRegistry services = (ServiceRegistry)factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
|
mutableAuthenticationDao = (MutableAuthenticationDao) factory.getBean("authenticationDao");
|
||||||
|
personService = (PersonService) services.getPersonService();
|
||||||
|
workflowService = (WorkflowService) services.getWorkflowService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.jbpm.graph.def.ActionHandler#execute(org.jbpm.graph.exe.ExecutionContext)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void execute(final ExecutionContext executionContext) throws Exception
|
||||||
|
{
|
||||||
|
// get the invitee user name
|
||||||
|
final String inviteeUserName = (String) executionContext.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
|
||||||
|
|
||||||
|
// clean up invitee's user account and person node if they are not in use i.e.
|
||||||
|
// account is still disabled and there are no pending invites outstanding for the
|
||||||
|
// invitee
|
||||||
|
InviteHelper.cleanUpStaleInviteeResources(inviteeUserName, mutableAuthenticationDao, personService,
|
||||||
|
workflowService);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.ModeratedInvitationProcess;
|
||||||
|
import org.alfresco.repo.invitation.NominatedInvitationProcess;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Site Private Invitation Process implements the PrivateInvitatonProcess for
|
||||||
|
* Web Sites.
|
||||||
|
*/
|
||||||
|
public class SiteModeratedInvitationProcess implements ModeratedInvitationProcess
|
||||||
|
{
|
||||||
|
|
||||||
|
public void approve(Invitation request, String reason) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancel(Invitation request, String reason) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reject(Invitation request, String reason) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Invitation invite(Invitation request, String reason) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancel(Invitation request) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.invitation.site;
|
||||||
|
|
||||||
|
import org.alfresco.repo.invitation.NominatedInvitationProcess;
|
||||||
|
import org.alfresco.service.cmr.invitation.Invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Site Private Invitation Process implements the PrivateInvitatonProcess for
|
||||||
|
* Web Sites.
|
||||||
|
*/
|
||||||
|
public class SiteNominatedInvitationProcess implements NominatedInvitationProcess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* inviter starts the invitation process
|
||||||
|
*/
|
||||||
|
public Invitation invite(Invitation request, String reason)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* invitee accepts this request
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
public void accept(Invitation request)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* invitee rejects this request
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
public void reject(Invitation request)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cancel this request
|
||||||
|
*/
|
||||||
|
public void cancel (Invitation request)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
The implementation of the Invitation Service for Web Site resources.
|
||||||
|
|
||||||
|
@see org.alfresco.service.cmr.invitation.InvitationService
|
||||||
|
|
@@ -28,7 +28,6 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import org.alfresco.mbeans.VirtServerRegistry;
|
import org.alfresco.mbeans.VirtServerRegistry;
|
||||||
import org.alfresco.repo.forms.FormService;
|
import org.alfresco.repo.forms.FormService;
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
@@ -40,6 +39,7 @@ import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
|||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||||
import org.alfresco.service.cmr.lock.LockService;
|
import org.alfresco.service.cmr.lock.LockService;
|
||||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||||
import org.alfresco.service.cmr.ml.EditionService;
|
import org.alfresco.service.cmr.ml.EditionService;
|
||||||
@@ -60,6 +60,7 @@ import org.alfresco.service.cmr.security.AuthorityService;
|
|||||||
import org.alfresco.service.cmr.security.OwnableService;
|
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.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||||
import org.alfresco.service.cmr.version.VersionService;
|
import org.alfresco.service.cmr.version.VersionService;
|
||||||
@@ -496,4 +497,13 @@ public class ServiceDescriptorRegistry
|
|||||||
{
|
{
|
||||||
return (FormService)getService(FORM_SERVICE);
|
return (FormService)getService(FORM_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.ServiceRegistry#getInvitationService()
|
||||||
|
*/
|
||||||
|
public InvitationService getInvitationService()
|
||||||
|
{
|
||||||
|
return (InvitationService)getService(INVITATION_SERVICE);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +38,7 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class SiteInfo
|
public class SiteInfoImpl implements SiteInfo
|
||||||
{
|
{
|
||||||
/** Site node reference */
|
/** Site node reference */
|
||||||
private NodeRef nodeRef;
|
private NodeRef nodeRef;
|
||||||
@@ -53,8 +55,8 @@ public class SiteInfo
|
|||||||
/** Site description */
|
/** Site description */
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
/** Indicates whether the site is public or not */
|
/** Site visibility */
|
||||||
private boolean isPublic;
|
private SiteVisibility visibility;
|
||||||
|
|
||||||
/** Set of custom properties that have been defined for site */
|
/** Set of custom properties that have been defined for site */
|
||||||
private Map<QName, Serializable> customProperties = new HashMap<QName, Serializable>(1);
|
private Map<QName, Serializable> customProperties = new HashMap<QName, Serializable>(1);
|
||||||
@@ -66,12 +68,12 @@ public class SiteInfo
|
|||||||
* @param shortName short name
|
* @param shortName short name
|
||||||
* @param title title
|
* @param title title
|
||||||
* @param description description
|
* @param description description
|
||||||
* @param isPublic is site public
|
* @param visibility site visibility
|
||||||
* @param nodeRef site node reference
|
* @param nodeRef site node reference
|
||||||
*/
|
*/
|
||||||
/*package*/ SiteInfo(String sitePreset, String shortName, String title, String description, boolean isPublic, Map<QName, Serializable> customProperties, NodeRef nodeRef)
|
/*package*/ SiteInfoImpl(String sitePreset, String shortName, String title, String description, SiteVisibility visibility, Map<QName, Serializable> customProperties, NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
this(sitePreset, shortName, title, description, isPublic, customProperties);
|
this(sitePreset, shortName, title, description, visibility, customProperties);
|
||||||
this.nodeRef = nodeRef;
|
this.nodeRef = nodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,15 +84,15 @@ public class SiteInfo
|
|||||||
* @param shortName short name
|
* @param shortName short name
|
||||||
* @param title title
|
* @param title title
|
||||||
* @param description description
|
* @param description description
|
||||||
* @param isPublic is site public
|
* @param visibility site visibility
|
||||||
*/
|
*/
|
||||||
/*package*/ SiteInfo(String sitePreset, String shortName, String title, String description, boolean isPublic, Map<QName, Serializable> customProperties)
|
/*package*/ SiteInfoImpl(String sitePreset, String shortName, String title, String description, SiteVisibility visibility, Map<QName, Serializable> customProperties)
|
||||||
{
|
{
|
||||||
this.sitePreset = sitePreset;
|
this.sitePreset = sitePreset;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.isPublic = isPublic;
|
this.visibility = visibility;
|
||||||
if (customProperties != null)
|
if (customProperties != null)
|
||||||
{
|
{
|
||||||
this.customProperties = customProperties;
|
this.customProperties = customProperties;
|
||||||
@@ -98,9 +100,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the site node reference
|
* @see org.alfresco.repo.site.SiteInfo#getNodeRef()
|
||||||
*
|
|
||||||
* @return NodeRef site node reference, null if not set
|
|
||||||
*/
|
*/
|
||||||
public NodeRef getNodeRef()
|
public NodeRef getNodeRef()
|
||||||
{
|
{
|
||||||
@@ -108,9 +108,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the site preset
|
* @see org.alfresco.repo.site.SiteInfo#getSitePreset()
|
||||||
*
|
|
||||||
* @return String site preset
|
|
||||||
*/
|
*/
|
||||||
public String getSitePreset()
|
public String getSitePreset()
|
||||||
{
|
{
|
||||||
@@ -118,9 +116,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the short name
|
* @see org.alfresco.repo.site.SiteInfo#getShortName()
|
||||||
*
|
|
||||||
* @return String short name
|
|
||||||
*/
|
*/
|
||||||
public String getShortName()
|
public String getShortName()
|
||||||
{
|
{
|
||||||
@@ -128,9 +124,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the title
|
* @see org.alfresco.repo.site.SiteInfo#getTitle()
|
||||||
*
|
|
||||||
* @return String site title
|
|
||||||
*/
|
*/
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
@@ -138,9 +132,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the title
|
* @see org.alfresco.repo.site.SiteInfo#setTitle(java.lang.String)
|
||||||
*
|
|
||||||
* @param title site title
|
|
||||||
*/
|
*/
|
||||||
public void setTitle(String title)
|
public void setTitle(String title)
|
||||||
{
|
{
|
||||||
@@ -148,9 +140,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description
|
* @see org.alfresco.repo.site.SiteInfo#getDescription()
|
||||||
*
|
|
||||||
* @return String site description
|
|
||||||
*/
|
*/
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
@@ -158,9 +148,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the description
|
* @see org.alfresco.repo.site.SiteInfo#setDescription(java.lang.String)
|
||||||
*
|
|
||||||
* @param description site description
|
|
||||||
*/
|
*/
|
||||||
public void setDescription(String description)
|
public void setDescription(String description)
|
||||||
{
|
{
|
||||||
@@ -168,29 +156,51 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the site is public or not
|
* @see org.alfresco.repo.site.SiteInfo#setIsPublic(boolean)
|
||||||
*
|
|
||||||
* @param isPublic true if the site is public, false otherwise
|
|
||||||
*/
|
*/
|
||||||
public void setIsPublic(boolean isPublic)
|
public void setIsPublic(boolean isPublic)
|
||||||
{
|
{
|
||||||
this.isPublic = isPublic;
|
if (isPublic == true)
|
||||||
|
{
|
||||||
|
setVisibility(SiteVisibility.PUBLIC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setVisibility(SiteVisibility.PRIVATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates wehther the site is public
|
* @see org.alfresco.repo.site.SiteInfo#getIsPublic()
|
||||||
*
|
|
||||||
* @return boolean true if public false otherwise
|
|
||||||
*/
|
*/
|
||||||
public boolean getIsPublic()
|
public boolean getIsPublic()
|
||||||
{
|
{
|
||||||
return this.isPublic;
|
boolean result = false;
|
||||||
|
if (SiteVisibility.PUBLIC.equals(this.visibility) == true)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom property values
|
* @see org.alfresco.service.cmr.site.SiteInfo#getVisibility()
|
||||||
*
|
*/
|
||||||
* @return Map<QName, Serializable> map of custom property names and values
|
public SiteVisibility getVisibility()
|
||||||
|
{
|
||||||
|
return this.visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.service.cmr.site.SiteInfo#setVisibility(org.alfresco.service.cmr.site.SiteVisibility)
|
||||||
|
*/
|
||||||
|
public void setVisibility(SiteVisibility visibility)
|
||||||
|
{
|
||||||
|
this.visibility = visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.site.SiteInfo#getCustomProperties()
|
||||||
*/
|
*/
|
||||||
public Map<QName, Serializable> getCustomProperties()
|
public Map<QName, Serializable> getCustomProperties()
|
||||||
{
|
{
|
||||||
@@ -198,10 +208,7 @@ public class SiteInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a custom property
|
* @see org.alfresco.repo.site.SiteInfo#getCustomProperty(org.alfresco.service.namespace.QName)
|
||||||
*
|
|
||||||
* @param name name of custom property
|
|
||||||
* @return Serializable value of the property, null if not set or doesn't exist
|
|
||||||
*/
|
*/
|
||||||
public Serializable getCustomProperty(QName name)
|
public Serializable getCustomProperty(QName name)
|
||||||
{
|
{
|
||||||
@@ -211,5 +218,35 @@ public class SiteInfo
|
|||||||
result = this.customProperties.get(name);
|
result = this.customProperties.get(name);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override equals for this ref type
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if (this == obj)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj instanceof SiteInfoImpl)
|
||||||
|
{
|
||||||
|
SiteInfoImpl that = (SiteInfoImpl) obj;
|
||||||
|
return (this.shortName.equals(that.shortName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see java.lang.Object#hashCode()
|
||||||
|
*/
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return this.shortName.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -43,6 +43,7 @@ public interface SiteModel
|
|||||||
public static final QName TYPE_SITES = QName.createQName(SITE_MODEL_URL, "sites");
|
public static final QName TYPE_SITES = QName.createQName(SITE_MODEL_URL, "sites");
|
||||||
public static final QName TYPE_SITE = QName.createQName(SITE_MODEL_URL, "site");
|
public static final QName TYPE_SITE = QName.createQName(SITE_MODEL_URL, "site");
|
||||||
public static final QName PROP_SITE_PRESET = QName.createQName(SITE_MODEL_URL, "sitePreset");
|
public static final QName PROP_SITE_PRESET = QName.createQName(SITE_MODEL_URL, "sitePreset");
|
||||||
|
public static final QName PROP_SITE_VISIBILITY = QName.createQName(SITE_MODEL_URL, "siteVisibility");
|
||||||
|
|
||||||
/** Site Container */
|
/** Site Container */
|
||||||
public static final QName ASPECT_SITE_CONTAINER = QName.createQName(SITE_MODEL_URL, "siteContainer");
|
public static final QName ASPECT_SITE_CONTAINER = QName.createQName(SITE_MODEL_URL, "siteContainer");
|
||||||
|
61
source/java/org/alfresco/repo/site/SiteServiceException.java
Normal file
61
source/java/org/alfresco/repo/site/SiteServiceException.java
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.site;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Site service exception
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class SiteServiceException extends AlfrescoRuntimeException
|
||||||
|
{
|
||||||
|
/** Serial version UID */
|
||||||
|
private static final long serialVersionUID = -5838634544722182609L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param msgId message id
|
||||||
|
*/
|
||||||
|
public SiteServiceException(String msgId)
|
||||||
|
{
|
||||||
|
super(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param msgId message id
|
||||||
|
* @param msgParams message params
|
||||||
|
*/
|
||||||
|
public SiteServiceException(String msgId, Object[] msgParams)
|
||||||
|
{
|
||||||
|
super(msgId, msgParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param msgId message id
|
||||||
|
* @param cause causing exception
|
||||||
|
*/
|
||||||
|
public SiteServiceException(String msgId, Throwable cause)
|
||||||
|
{
|
||||||
|
super(msgId, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param msgId message id
|
||||||
|
* @param msgParams message params
|
||||||
|
* @param cause causing exception
|
||||||
|
*/
|
||||||
|
public SiteServiceException(String msgId, Object[] msgParams, Throwable cause)
|
||||||
|
{
|
||||||
|
super(msgId, msgParams, cause);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@@ -34,11 +34,19 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.model.ForumModel;
|
import org.alfresco.model.ForumModel;
|
||||||
import org.alfresco.repo.jscript.ClasspathScriptLocation;
|
import org.alfresco.repo.jscript.ClasspathScriptLocation;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
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.ScriptLocation;
|
import org.alfresco.service.cmr.repository.ScriptLocation;
|
||||||
import org.alfresco.service.cmr.repository.ScriptService;
|
import org.alfresco.service.cmr.repository.ScriptService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.BaseAlfrescoSpringTest;
|
import org.alfresco.util.BaseAlfrescoSpringTest;
|
||||||
@@ -59,6 +67,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
private static final String USER_ONE = "UserOne_SiteServiceImplTest";
|
private static final String USER_ONE = "UserOne_SiteServiceImplTest";
|
||||||
private static final String USER_TWO = "UserTwo_SiteServiceImplTest";
|
private static final String USER_TWO = "UserTwo_SiteServiceImplTest";
|
||||||
private static final String USER_THREE = "UserThree_SiteServiceImplTest";
|
private static final String USER_THREE = "UserThree_SiteServiceImplTest";
|
||||||
|
private static final String GROUP_ONE = "GrpOne_SiteServiceImplTest";
|
||||||
|
private static final String GROUP_TWO = "GrpTwo_SiteServiceImplTest";
|
||||||
|
|
||||||
private SiteService siteService;
|
private SiteService siteService;
|
||||||
private ScriptService scriptService;
|
private ScriptService scriptService;
|
||||||
@@ -66,6 +76,11 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
private AuthenticationComponent authenticationComponent;
|
private AuthenticationComponent authenticationComponent;
|
||||||
private TaggingService taggingService;
|
private TaggingService taggingService;
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
private AuthorityService authorityService;
|
||||||
|
private FileFolderService fileFolderService;
|
||||||
|
|
||||||
|
private String groupOne;
|
||||||
|
private String groupTwo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called during the transaction setup
|
* Called during the transaction setup
|
||||||
@@ -81,11 +96,22 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
|
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
|
||||||
this.taggingService = (TaggingService)this.applicationContext.getBean("TaggingService");
|
this.taggingService = (TaggingService)this.applicationContext.getBean("TaggingService");
|
||||||
this.personService = (PersonService)this.applicationContext.getBean("PersonService");
|
this.personService = (PersonService)this.applicationContext.getBean("PersonService");
|
||||||
|
this.authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService");
|
||||||
|
this.fileFolderService = (FileFolderService)this.applicationContext.getBean("FileFolderService");
|
||||||
|
|
||||||
// Do the test's as userOne
|
// Create the test users
|
||||||
createUser(USER_ONE);
|
createUser(USER_ONE);
|
||||||
createUser(USER_TWO);
|
createUser(USER_TWO);
|
||||||
createUser(USER_THREE);
|
createUser(USER_THREE);
|
||||||
|
|
||||||
|
// Create the test groups
|
||||||
|
this.groupOne = this.authorityService.createAuthority(AuthorityType.GROUP, null, GROUP_ONE);
|
||||||
|
this.authorityService.addAuthority(this.groupOne, USER_TWO);
|
||||||
|
this.groupTwo = this.authorityService.createAuthority(AuthorityType.GROUP, null, GROUP_TWO);
|
||||||
|
this.authorityService.addAuthority(this.groupTwo, USER_TWO);
|
||||||
|
this.authorityService.addAuthority(this.groupTwo, USER_THREE);
|
||||||
|
|
||||||
|
// Set the current authentication
|
||||||
this.authenticationComponent.setCurrentUser(USER_ONE);
|
this.authenticationComponent.setCurrentUser(USER_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,25 +135,25 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
public void testCreateSite() throws Exception
|
public void testCreateSite() throws Exception
|
||||||
{
|
{
|
||||||
// Create a public site
|
// Create a public site
|
||||||
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
String name = "!£$%^&*()_+=-[]{}";
|
String name = "!£$%^&*()_+=-[]{}";
|
||||||
siteInfo = this.siteService.createSite(TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
siteInfo = this.siteService.createSite(TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
siteInfo = this.siteService.getSite(name);
|
siteInfo = this.siteService.getSite(name);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
name = "éíóúÁÉÍÓÚ";
|
name = "éíóúÁÉÍÓÚ";
|
||||||
siteInfo = this.siteService.createSite(TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
siteInfo = this.siteService.createSite(TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
siteInfo = this.siteService.getSite(name);
|
siteInfo = this.siteService.getSite(name);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, name, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
// Test for duplicate site error
|
// Test for duplicate site error
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
fail("Shouldn't allow duplicate site short names.");
|
fail("Shouldn't allow duplicate site short names.");
|
||||||
}
|
}
|
||||||
catch (AlfrescoRuntimeException exception)
|
catch (AlfrescoRuntimeException exception)
|
||||||
@@ -138,8 +164,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
|
|
||||||
public void testETHREEOH_15() throws Exception
|
public void testETHREEOH_15() throws Exception
|
||||||
{
|
{
|
||||||
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
authenticationComponent.setCurrentUser("admin");
|
authenticationComponent.setCurrentUser("admin");
|
||||||
this.siteService.setMembership(siteInfo.getShortName(), USER_TWO, SiteModel.SITE_MANAGER);
|
this.siteService.setMembership(siteInfo.getShortName(), USER_TWO, SiteModel.SITE_MANAGER);
|
||||||
@@ -170,15 +196,19 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
this.siteService.removeMembership(siteInfo.getShortName(), USER_THREE);
|
this.siteService.removeMembership(siteInfo.getShortName(), USER_THREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSiteInfo( SiteInfo siteInfo, String expectedSitePreset, String expectedShortName, String expectedTitle,
|
private void checkSiteInfo(SiteInfo siteInfo,
|
||||||
String expectedDescription, boolean expectedIsPublic)
|
String expectedSitePreset,
|
||||||
|
String expectedShortName,
|
||||||
|
String expectedTitle,
|
||||||
|
String expectedDescription,
|
||||||
|
SiteVisibility expectedVisibility)
|
||||||
{
|
{
|
||||||
assertNotNull(siteInfo);
|
assertNotNull(siteInfo);
|
||||||
assertEquals(expectedSitePreset, siteInfo.getSitePreset());
|
assertEquals(expectedSitePreset, siteInfo.getSitePreset());
|
||||||
assertEquals(expectedShortName, siteInfo.getShortName());
|
assertEquals(expectedShortName, siteInfo.getShortName());
|
||||||
assertEquals(expectedTitle, siteInfo.getTitle());
|
assertEquals(expectedTitle, siteInfo.getTitle());
|
||||||
assertEquals(expectedDescription, siteInfo.getDescription());
|
assertEquals(expectedDescription, siteInfo.getDescription());
|
||||||
assertEquals(expectedIsPublic, siteInfo.getIsPublic());
|
assertEquals(expectedVisibility, siteInfo.getVisibility());
|
||||||
assertNotNull(siteInfo.getNodeRef());
|
assertNotNull(siteInfo.getNodeRef());
|
||||||
|
|
||||||
// Check that the site is a tag scope
|
// Check that the site is a tag scope
|
||||||
@@ -197,10 +227,10 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
assertTrue(sites.isEmpty());
|
assertTrue(sites.isEmpty());
|
||||||
|
|
||||||
// Create some sites
|
// Create some sites
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "mySiteOne", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "mySiteOne", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "mySiteTwo", TEST_TITLE, TEST_DESCRIPTION, false);
|
this.siteService.createSite(TEST_SITE_PRESET, "mySiteTwo", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
this.siteService.createSite(TEST_SITE_PRESET_2, "mySiteThree", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET_2, "mySiteThree", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
this.siteService.createSite(TEST_SITE_PRESET_2, "mySiteFour", TEST_TITLE, TEST_DESCRIPTION, false);
|
this.siteService.createSite(TEST_SITE_PRESET_2, "mySiteFour", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
// Get all the sites
|
// Get all the sites
|
||||||
sites = this.siteService.listSites(null, null);
|
sites = this.siteService.listSites(null, null);
|
||||||
@@ -212,19 +242,19 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
String shortName = site.getShortName();
|
String shortName = site.getShortName();
|
||||||
if (shortName.equals("mySiteOne") == true)
|
if (shortName.equals("mySiteOne") == true)
|
||||||
{
|
{
|
||||||
checkSiteInfo(site, TEST_SITE_PRESET, "mySiteOne", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(site, TEST_SITE_PRESET, "mySiteOne", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
}
|
}
|
||||||
else if (shortName.equals("mySiteTwo") == true)
|
else if (shortName.equals("mySiteTwo") == true)
|
||||||
{
|
{
|
||||||
checkSiteInfo(site, TEST_SITE_PRESET, "mySiteTwo", TEST_TITLE, TEST_DESCRIPTION, false);
|
checkSiteInfo(site, TEST_SITE_PRESET, "mySiteTwo", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
}
|
}
|
||||||
else if (shortName.equals("mySiteThree") == true)
|
else if (shortName.equals("mySiteThree") == true)
|
||||||
{
|
{
|
||||||
checkSiteInfo(site, TEST_SITE_PRESET_2, "mySiteThree", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(site, TEST_SITE_PRESET_2, "mySiteThree", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
}
|
}
|
||||||
else if (shortName.equals("mySiteFour") == true)
|
else if (shortName.equals("mySiteFour") == true)
|
||||||
{
|
{
|
||||||
checkSiteInfo(site, TEST_SITE_PRESET_2, "mySiteFour", TEST_TITLE, TEST_DESCRIPTION, false);
|
checkSiteInfo(site, TEST_SITE_PRESET_2, "mySiteFour", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -256,17 +286,17 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
assertNull(siteInfo);
|
assertNull(siteInfo);
|
||||||
|
|
||||||
// Create a test site
|
// Create a test site
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
// Get the test site
|
// Get the test site
|
||||||
siteInfo = this.siteService.getSite("testGetSite");
|
siteInfo = this.siteService.getSite("testGetSite");
|
||||||
assertNotNull(siteInfo);
|
assertNotNull(siteInfo);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateSite()
|
public void testUpdateSite()
|
||||||
{
|
{
|
||||||
SiteInfo siteInfo = new SiteInfo(TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", false, null);
|
SiteInfo siteInfo = new SiteInfoImpl(TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PRIVATE, null);
|
||||||
|
|
||||||
// update a site that isn't there
|
// update a site that isn't there
|
||||||
try
|
try
|
||||||
@@ -280,17 +310,17 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a test site
|
// Create a test site
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testUpdateSite", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "testUpdateSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
// Update the details of the site
|
// Update the details of the site
|
||||||
this.siteService.updateSite(siteInfo);
|
this.siteService.updateSite(siteInfo);
|
||||||
siteInfo = this.siteService.getSite("testUpdateSite");
|
siteInfo = this.siteService.getSite("testUpdateSite");
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", false);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
// Update the permission again
|
// Update the permission again
|
||||||
siteInfo.setIsPublic(true);
|
siteInfo.setVisibility(SiteVisibility.PUBLIC);
|
||||||
this.siteService.updateSite(siteInfo);
|
this.siteService.updateSite(siteInfo);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PUBLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteSite()
|
public void testDeleteSite()
|
||||||
@@ -307,7 +337,7 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a test site
|
// Create a test site
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testUpdateSite", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "testUpdateSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
assertNotNull(this.siteService.getSite("testUpdateSite"));
|
assertNotNull(this.siteService.getSite("testUpdateSite"));
|
||||||
|
|
||||||
// Delete the site
|
// Delete the site
|
||||||
@@ -318,8 +348,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
public void testIsPublic()
|
public void testIsPublic()
|
||||||
{
|
{
|
||||||
// Create a couple of sites as user one
|
// Create a couple of sites as user one
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "isPublicTrue", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "isPublicTrue", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "isPublicFalse", TEST_TITLE, TEST_DESCRIPTION, false);
|
this.siteService.createSite(TEST_SITE_PRESET, "isPublicFalse", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
// Get the sites as user one
|
// Get the sites as user one
|
||||||
List<SiteInfo> sites = this.siteService.listSites(null, null);
|
List<SiteInfo> sites = this.siteService.listSites(null, null);
|
||||||
@@ -331,7 +361,7 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
sites = this.siteService.listSites(null, null);
|
sites = this.siteService.listSites(null, null);
|
||||||
assertNotNull(sites);
|
assertNotNull(sites);
|
||||||
assertEquals(1, sites.size());
|
assertEquals(1, sites.size());
|
||||||
checkSiteInfo(sites.get(0), TEST_SITE_PRESET, "isPublicTrue", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(sites.get(0), TEST_SITE_PRESET, "isPublicTrue", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
// Make user 2 a member of the site
|
// Make user 2 a member of the site
|
||||||
//TestWithUserUtils.authenticateUser(USER_ONE, "PWD", this.authenticationService, this.authenticationComponent);
|
//TestWithUserUtils.authenticateUser(USER_ONE, "PWD", this.authenticationService, this.authenticationComponent);
|
||||||
@@ -348,7 +378,7 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
public void testMembership()
|
public void testMembership()
|
||||||
{
|
{
|
||||||
// Create a site as user one
|
// Create a site as user one
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testMembership", TEST_TITLE, TEST_DESCRIPTION, false);
|
this.siteService.createSite(TEST_SITE_PRESET, "testMembership", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
// Get the members of the site and check that user one is a manager
|
// Get the members of the site and check that user one is a manager
|
||||||
Map<String, String> members = this.siteService.listMembers("testMembership", null, null);
|
Map<String, String> members = this.siteService.listMembers("testMembership", null, null);
|
||||||
@@ -477,8 +507,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
public void testJoinLeave()
|
public void testJoinLeave()
|
||||||
{
|
{
|
||||||
// Create a site as user one
|
// Create a site as user one
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testMembership", TEST_TITLE, TEST_DESCRIPTION, true);
|
this.siteService.createSite(TEST_SITE_PRESET, "testMembership", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
this.siteService.createSite(TEST_SITE_PRESET, "testMembershipPrivate", TEST_TITLE, TEST_DESCRIPTION, false);
|
this.siteService.createSite(TEST_SITE_PRESET, "testMembershipPrivate", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
// Become user two
|
// Become user two
|
||||||
//TestWithUserUtils.authenticateUser(USER_TWO, "PWD", this.authenticationService, this.authenticationComponent);
|
//TestWithUserUtils.authenticateUser(USER_TWO, "PWD", this.authenticationService, this.authenticationComponent);
|
||||||
@@ -545,7 +575,7 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
public void testContainer()
|
public void testContainer()
|
||||||
{
|
{
|
||||||
// Create a couple of sites as user one
|
// Create a couple of sites as user one
|
||||||
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "testContainer", TEST_TITLE, TEST_DESCRIPTION, true);
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "testContainer", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
|
||||||
boolean hasContainer = this.siteService.hasContainer(siteInfo.getShortName(), "folder.component");
|
boolean hasContainer = this.siteService.hasContainer(siteInfo.getShortName(), "folder.component");
|
||||||
assertFalse(hasContainer);
|
assertFalse(hasContainer);
|
||||||
@@ -614,8 +644,8 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
QName additionalInformationQName = QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation");
|
QName additionalInformationQName = QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation");
|
||||||
|
|
||||||
// Create a site
|
// Create a site
|
||||||
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, true);
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "mySiteTest", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
assertNull(siteInfo.getCustomProperty(additionalInformationQName));
|
assertNull(siteInfo.getCustomProperty(additionalInformationQName));
|
||||||
assertNotNull(siteInfo.getCustomProperties());
|
assertNotNull(siteInfo.getCustomProperties());
|
||||||
assertTrue(siteInfo.getCustomProperties().isEmpty());
|
assertTrue(siteInfo.getCustomProperties().isEmpty());
|
||||||
@@ -637,12 +667,239 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGroupMembership()
|
||||||
|
{
|
||||||
|
// USER_ONE - SiteAdmin
|
||||||
|
// GROUP_ONE - USER_TWO
|
||||||
|
// GROUP_TWO - USER_TWO, USER_THREE
|
||||||
|
|
||||||
|
// Create a site as user one
|
||||||
|
this.siteService.createSite(TEST_SITE_PRESET, "testMembership", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
|
||||||
|
// Get the members of the site and check that user one is a manager
|
||||||
|
Map<String, String> members = this.siteService.listMembers("testMembership", null, null);
|
||||||
|
assertNotNull(members);
|
||||||
|
assertEquals(1, members.size());
|
||||||
|
assertTrue(members.containsKey(USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, members.get(USER_ONE));
|
||||||
|
|
||||||
|
// Add a group
|
||||||
|
this.siteService.setMembership("testMembership", this.groupTwo, SiteModel.SITE_CONSUMER);
|
||||||
|
// - is the group in the list of all members?
|
||||||
|
members = this.siteService.listMembers("testMembership", null, null);
|
||||||
|
assertNotNull(members);
|
||||||
|
assertEquals(2, members.size());
|
||||||
|
assertTrue(members.containsKey(USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, members.get(USER_ONE));
|
||||||
|
assertTrue(members.containsKey(this.groupTwo));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, members.get(this.groupTwo));
|
||||||
|
// - is the user in the expanded list?
|
||||||
|
members = this.siteService.listMembers("testMembership", null, null, true);
|
||||||
|
assertNotNull(members);
|
||||||
|
assertEquals(3, members.size());
|
||||||
|
assertTrue(members.containsKey(USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, members.get(USER_ONE));
|
||||||
|
assertTrue(members.containsKey(USER_TWO));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, members.get(USER_TWO));
|
||||||
|
assertTrue(members.containsKey(USER_THREE));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, members.get(USER_THREE));
|
||||||
|
// - is the user a member?
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_ONE));
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_TWO));
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_THREE));
|
||||||
|
// - is the group a member?
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", this.groupTwo));
|
||||||
|
// - can we get the roles for the various members directly
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, this.siteService.getMembersRole("testMembership", USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, this.siteService.getMembersRole("testMembership", USER_TWO));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, this.siteService.getMembersRole("testMembership", USER_THREE));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, this.siteService.getMembersRole("testMembership", this.groupTwo));
|
||||||
|
|
||||||
|
// Add a group member as an explicit member
|
||||||
|
this.siteService.setMembership("testMembership", USER_THREE, SiteModel.SITE_COLLABORATOR);
|
||||||
|
// - check the explicit members list
|
||||||
|
members = this.siteService.listMembers("testMembership", null, null);
|
||||||
|
assertNotNull(members);
|
||||||
|
assertEquals(3, members.size());
|
||||||
|
assertTrue(members.containsKey(USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, members.get(USER_ONE));
|
||||||
|
assertTrue(members.containsKey(USER_THREE));
|
||||||
|
assertEquals(SiteModel.SITE_COLLABORATOR, members.get(USER_THREE));
|
||||||
|
assertTrue(members.containsKey(this.groupTwo));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, members.get(this.groupTwo));
|
||||||
|
// - check the expanded members list
|
||||||
|
members = this.siteService.listMembers("testMembership", null, null, true);
|
||||||
|
assertNotNull(members);
|
||||||
|
assertEquals(3, members.size());
|
||||||
|
assertTrue(members.containsKey(USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, members.get(USER_ONE));
|
||||||
|
assertTrue(members.containsKey(USER_TWO));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, members.get(USER_TWO));
|
||||||
|
assertTrue(members.containsKey(USER_THREE));
|
||||||
|
assertEquals(SiteModel.SITE_COLLABORATOR, members.get(USER_THREE));
|
||||||
|
// - check is member
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_ONE));
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_TWO));
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", USER_THREE));
|
||||||
|
// - is the group a member?
|
||||||
|
assertTrue(this.siteService.isMember("testMembership", this.groupTwo));
|
||||||
|
// - check get role directly
|
||||||
|
assertEquals(SiteModel.SITE_MANAGER, this.siteService.getMembersRole("testMembership", USER_ONE));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, this.siteService.getMembersRole("testMembership", USER_TWO));
|
||||||
|
assertEquals(SiteModel.SITE_COLLABORATOR, this.siteService.getMembersRole("testMembership", USER_THREE));
|
||||||
|
assertEquals(SiteModel.SITE_CONSUMER, this.siteService.getMembersRole("testMembership", this.groupTwo));
|
||||||
|
|
||||||
|
// Check permissions of added group
|
||||||
|
|
||||||
|
// Update the permissions of the group
|
||||||
|
|
||||||
|
// Add other group with higher role
|
||||||
|
// - is group in list?
|
||||||
|
// - is new user a member?
|
||||||
|
// - does redefined user have highest role?
|
||||||
|
|
||||||
|
// Add group user as a specific user with higher role
|
||||||
|
// - check that the user's role is higher that the group?
|
||||||
|
|
||||||
|
// Add a group with a sub-group
|
||||||
|
|
||||||
|
// Remove groups
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the visibility of a site
|
||||||
|
*
|
||||||
|
* See https://issues.alfresco.com/jira/browse/JAWS-291
|
||||||
|
*/
|
||||||
|
public void testSiteVisibility()
|
||||||
|
{
|
||||||
|
// Create a public site
|
||||||
|
SiteInfo siteInfo = createTestSiteWithContent("testSiteVisibilityPublicSite", "testComp", SiteVisibility.PUBLIC);
|
||||||
|
// - is the value on the site nodeRef correct?
|
||||||
|
assertEquals(SiteVisibility.PUBLIC.toString(), this.nodeService.getProperty(siteInfo.getNodeRef(), SiteModel.PROP_SITE_VISIBILITY));
|
||||||
|
// - is the site info correct?
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityPublicSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityPublicSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityPublicSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
// - are the permissions correct for non-members?
|
||||||
|
testVisibilityPermissions("Testing visibility of public site", USER_TWO, siteInfo, true, true);
|
||||||
|
|
||||||
|
// Create a moderated site
|
||||||
|
siteInfo = createTestSiteWithContent("testSiteVisibilityModeratedSite", "testComp", SiteVisibility.MODERATED);
|
||||||
|
// - is the value on the site nodeRef correct?
|
||||||
|
assertEquals(SiteVisibility.MODERATED.toString(), this.nodeService.getProperty(siteInfo.getNodeRef(), SiteModel.PROP_SITE_VISIBILITY));
|
||||||
|
// - is the site info correct?
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityModeratedSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityModeratedSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityModeratedSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
|
||||||
|
// - are the permissions correct for non-members?
|
||||||
|
testVisibilityPermissions("Testing visibility of moderated site", USER_TWO, siteInfo, true, false);
|
||||||
|
|
||||||
|
// Create a private site
|
||||||
|
siteInfo = createTestSiteWithContent("testSiteVisibilityPrivateSite", "testComp", SiteVisibility.PRIVATE);
|
||||||
|
// - is the value on the site nodeRef correct?
|
||||||
|
assertEquals(SiteVisibility.PRIVATE.toString(), this.nodeService.getProperty(siteInfo.getNodeRef(), SiteModel.PROP_SITE_VISIBILITY));
|
||||||
|
// - is the site info correct?
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityPrivateSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityPrivateSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityPrivateSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
// - are the permissions correct for non-members?
|
||||||
|
testVisibilityPermissions("Testing visibility of private site", USER_TWO, siteInfo, false, false);
|
||||||
|
|
||||||
|
SiteInfo changeSite = createTestSiteWithContent("testSiteVisibilityChangeSite", "testComp", SiteVisibility.PUBLIC);
|
||||||
|
// Switch from public -> moderated
|
||||||
|
changeSite.setVisibility(SiteVisibility.MODERATED);
|
||||||
|
this.siteService.updateSite(changeSite);
|
||||||
|
// - check the updated sites visibility
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityChangeSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityChangeSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.MODERATED);
|
||||||
|
testVisibilityPermissions("Testing visibility of moderated site", USER_TWO, siteInfo, true, false);
|
||||||
|
|
||||||
|
// Switch from moderated -> private
|
||||||
|
changeSite.setVisibility(SiteVisibility.PRIVATE);
|
||||||
|
this.siteService.updateSite(changeSite);
|
||||||
|
// - check the updated sites visibility
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityChangeSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityChangeSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PRIVATE);
|
||||||
|
testVisibilityPermissions("Testing visibility of moderated site", USER_TWO, siteInfo, false, false);
|
||||||
|
|
||||||
|
// Switch from private -> public
|
||||||
|
changeSite.setVisibility(SiteVisibility.PUBLIC);
|
||||||
|
this.siteService.updateSite(changeSite);
|
||||||
|
// - check the updated sites visibility
|
||||||
|
siteInfo = this.siteService.getSite("testSiteVisibilityChangeSite");
|
||||||
|
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testSiteVisibilityChangeSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
|
testVisibilityPermissions("Testing visibility of moderated site", USER_TWO, siteInfo, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SiteInfo createTestSiteWithContent(String shortName, String compName, SiteVisibility visibility)
|
||||||
|
{
|
||||||
|
// Create a public site
|
||||||
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET,
|
||||||
|
shortName,
|
||||||
|
TEST_TITLE,
|
||||||
|
TEST_DESCRIPTION,
|
||||||
|
visibility);
|
||||||
|
NodeRef foldeRef = this.siteService.createContainer(shortName, compName, ContentModel.TYPE_FOLDER, null);
|
||||||
|
FileInfo fileInfo = this.fileFolderService.create(foldeRef, "test.txt", ContentModel.TYPE_CONTENT);
|
||||||
|
ContentWriter writer = this.fileFolderService.getWriter(fileInfo.getNodeRef());
|
||||||
|
writer.putContent("Just some old content that doesn't mean anything");
|
||||||
|
|
||||||
|
return siteInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testVisibilityPermissions(String message, String userName, SiteInfo siteInfo, boolean listSite, boolean readSite)
|
||||||
|
{
|
||||||
|
String holdUser = this.authenticationComponent.getCurrentUserName();
|
||||||
|
this.authenticationComponent.setCurrentUser(userName);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Can the site be seen in the list sites by the user?
|
||||||
|
List<SiteInfo> sites = this.siteService.listSites(null, null);
|
||||||
|
boolean siteInList = sites.contains(siteInfo);
|
||||||
|
if (listSite == true && siteInList == false)
|
||||||
|
{
|
||||||
|
fail(message + ": The site '" + siteInfo.getShortName() + "' was expected in the list of sites for user '" + userName + "'");
|
||||||
|
}
|
||||||
|
else if (listSite == false && siteInList == true)
|
||||||
|
{
|
||||||
|
fail(message + ": The site '" + siteInfo.getShortName() + "' was NOT expected in the list of sites for user '" + userName + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (siteInList == true)
|
||||||
|
{
|
||||||
|
// Can site content be read by the user?
|
||||||
|
NodeRef folder = this.siteService.getContainer(siteInfo.getShortName(), "testComp");
|
||||||
|
List<FileInfo> files = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
files = this.fileFolderService.listFiles(folder);
|
||||||
|
if (readSite == false)
|
||||||
|
{
|
||||||
|
fail(message + ": Content of the site '" + siteInfo.getShortName() + "' was NOT expected to be read by user '" + userName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
if (readSite == true)
|
||||||
|
{
|
||||||
|
fail(message + ": Content of the site '" + siteInfo.getShortName() + "' was expected to be read by user '" + userName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.authenticationComponent.setCurrentUser(holdUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// == Test the JavaScript API ==
|
// == Test the JavaScript API ==
|
||||||
|
|
||||||
public void testJSAPI() throws Exception
|
public void testJSAPI() throws Exception
|
||||||
{
|
{
|
||||||
// Create a site with a custom property
|
// Create a site with a custom property
|
||||||
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteWithCustomProperty", TEST_TITLE, TEST_DESCRIPTION, true);
|
SiteInfo siteInfo = this.siteService.createSite(TEST_SITE_PRESET, "mySiteWithCustomProperty", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
|
||||||
NodeRef siteNodeRef = siteInfo.getNodeRef();
|
NodeRef siteNodeRef = siteInfo.getNodeRef();
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
||||||
properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
|
properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
|
||||||
|
@@ -28,9 +28,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||||
import org.alfresco.repo.site.SiteInfo;
|
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +42,11 @@ import org.alfresco.service.ServiceRegistry;
|
|||||||
*/
|
*/
|
||||||
public class ScriptSiteService extends BaseScopableProcessorExtension
|
public class ScriptSiteService extends BaseScopableProcessorExtension
|
||||||
{
|
{
|
||||||
|
/** Visibility helper constants */
|
||||||
|
public static final String PUBLIC_SITE = "PUBLIC";
|
||||||
|
public static final String MODERATED_SITE = "MODERATED";
|
||||||
|
public static final String PRIVATE_SITE = "PRIVATE";
|
||||||
|
|
||||||
/** Service Registry */
|
/** Service Registry */
|
||||||
private ServiceRegistry serviceRegistry;
|
private ServiceRegistry serviceRegistry;
|
||||||
|
|
||||||
@@ -66,6 +73,23 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
this.siteService = siteService;
|
this.siteService = siteService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see {@link #createSite(String, String, String, String, String)}
|
||||||
|
*
|
||||||
|
* @param sitePreset site preset
|
||||||
|
* @param shortName site short name
|
||||||
|
* @param title site title
|
||||||
|
* @param description site description
|
||||||
|
* @param isPublic whether the site is public or not
|
||||||
|
* @return Site the created site
|
||||||
|
* @deprecated as of version 3.2, replaced by {@link #createSite(String, String, String, String, String)}
|
||||||
|
*/
|
||||||
|
public Site createSite(String sitePreset, String shortName, String title, String description, boolean isPublic)
|
||||||
|
{
|
||||||
|
SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, isPublic);
|
||||||
|
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new site.
|
* Create a new site.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -74,13 +98,15 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
* @param sitePreset site preset
|
* @param sitePreset site preset
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param title site title
|
* @param title site title
|
||||||
* @param description site description
|
* @param description site description
|
||||||
* @param isPublic whether the site is public or not
|
* @param visibility visibility of the site (public|moderated|private)
|
||||||
* @return Site the created site
|
* @return Site the created site
|
||||||
*/
|
*/
|
||||||
public Site createSite(String sitePreset, String shortName, String title, String description, boolean isPublic)
|
public Site createSite(String sitePreset, String shortName, String title, String description, String visibility)
|
||||||
{
|
{
|
||||||
SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, isPublic);
|
ParameterCheck.mandatoryString("visibility", visibility);
|
||||||
|
SiteVisibility siteVisibility = SiteVisibility.valueOf(visibility);
|
||||||
|
SiteInfo siteInfo = this.siteService.createSite(sitePreset, shortName, title, description, siteVisibility);
|
||||||
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
|
return new Site(siteInfo, this.serviceRegistry, this.siteService, getScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +168,7 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the roles that can be assigned to a memeber of a site.
|
* Returns an array of all the roles that can be assigned to a member of a site.
|
||||||
*
|
*
|
||||||
* @return String[] roles available to assign to a member of a site
|
* @return String[] roles available to assign to a member of a site
|
||||||
*/
|
*/
|
||||||
|
@@ -37,14 +37,16 @@ import org.alfresco.repo.jscript.ScriptNode.NodeValueConverter;
|
|||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.site.SiteInfo;
|
|
||||||
import org.alfresco.repo.site.SiteModel;
|
import org.alfresco.repo.site.SiteModel;
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
import org.mozilla.javascript.ScriptableObject;
|
||||||
|
|
||||||
@@ -158,7 +160,8 @@ public class Site implements Serializable
|
|||||||
/**
|
/**
|
||||||
* Gets whether the site is public or not
|
* Gets whether the site is public or not
|
||||||
*
|
*
|
||||||
* @return true is public false otherwise
|
* @return true is public false otherwise
|
||||||
|
* @deprecated since version 3.2, replaced by {@link #getVisibility()}
|
||||||
*/
|
*/
|
||||||
public boolean getIsPublic()
|
public boolean getIsPublic()
|
||||||
{
|
{
|
||||||
@@ -169,6 +172,7 @@ public class Site implements Serializable
|
|||||||
* Set whether the site is public or not
|
* Set whether the site is public or not
|
||||||
*
|
*
|
||||||
* @param isPublic true the site is public false otherwise
|
* @param isPublic true the site is public false otherwise
|
||||||
|
* @deprecated since version 3.2, replaced by {@link #setVisibility(String)}
|
||||||
*/
|
*/
|
||||||
public void setIsPublic(boolean isPublic)
|
public void setIsPublic(boolean isPublic)
|
||||||
{
|
{
|
||||||
@@ -176,6 +180,29 @@ public class Site implements Serializable
|
|||||||
this.siteInfo.setIsPublic(isPublic);
|
this.siteInfo.setIsPublic(isPublic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the site visibility
|
||||||
|
*
|
||||||
|
* @return String site visibility
|
||||||
|
*/
|
||||||
|
public String getVisibility()
|
||||||
|
{
|
||||||
|
return this.siteInfo.getVisibility().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the site visibility
|
||||||
|
*
|
||||||
|
* @param visibility site visibility (public|moderated|private)
|
||||||
|
*/
|
||||||
|
public void setVisibility(String visibility)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatoryString("visibility", visibility);
|
||||||
|
SiteVisibility siteVisibility = SiteVisibility.valueOf(visibility);
|
||||||
|
this.siteInfo.setVisibility(siteVisibility);
|
||||||
|
this.isDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the site node, null if none
|
* Get the site node, null if none
|
||||||
*
|
*
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
function checkSite(site, sitePreset, shortName, title, description, isPublic)
|
function checkSite(site, sitePreset, shortName, title, description, visibility)
|
||||||
{
|
{
|
||||||
test.assertNotNull(site);
|
test.assertNotNull(site);
|
||||||
test.assertEquals(sitePreset, site.sitePreset);
|
test.assertEquals(sitePreset, site.sitePreset);
|
||||||
test.assertEquals(shortName, site.shortName);
|
test.assertEquals(shortName, site.shortName);
|
||||||
test.assertEquals(title, site.title);
|
test.assertEquals(title, site.title);
|
||||||
test.assertEquals(description, site.description);
|
test.assertEquals(description, site.description);
|
||||||
test.assertEquals(isPublic, site.isPublic);
|
test.assertEquals(visibility, site.visibility);
|
||||||
test.assertNotNull(site.node);
|
test.assertNotNull(site.node);
|
||||||
test.assertTrue(site.node.isTagScope);
|
test.assertTrue(site.node.isTagScope);
|
||||||
}
|
}
|
||||||
@@ -17,21 +17,21 @@ function testCRUD()
|
|||||||
test.assertNull(site, "Site should not have been found.");
|
test.assertNull(site, "Site should not have been found.");
|
||||||
|
|
||||||
// Try and create a site
|
// Try and create a site
|
||||||
site = siteService.createSite("sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
|
site = siteService.createSite("sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
|
||||||
checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
|
checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
|
||||||
|
|
||||||
// Try and get the created site
|
// Try and get the created site
|
||||||
site = siteService.getSite("siteShortNameCRUD");
|
site = siteService.getSite("siteShortNameCRUD");
|
||||||
checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", true);
|
checkSite(site, "sitePreset", "siteShortNameCRUD", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
|
||||||
|
|
||||||
// Try and update the values of the site
|
// Try and update the values of the site
|
||||||
site.title = "abc123abc";
|
site.title = "abc123abc";
|
||||||
site.description = "abc123abc";
|
site.description = "abc123abc";
|
||||||
site.isPublic = false;
|
site.visibility = siteService.PRIVATE_SITE;
|
||||||
checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", false);
|
checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", siteService.PRIVATE_SITE);
|
||||||
site.save();
|
site.save();
|
||||||
site = siteService.getSite("siteShortNameCRUD");
|
site = siteService.getSite("siteShortNameCRUD");
|
||||||
checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", false);
|
checkSite(site, "sitePreset", "siteShortNameCRUD", "abc123abc", "abc123abc", siteService.PRIVATE_SITE);
|
||||||
|
|
||||||
// Delete the site
|
// Delete the site
|
||||||
site.deleteSite();
|
site.deleteSite();
|
||||||
@@ -42,8 +42,8 @@ function testCRUD()
|
|||||||
function testListSites()
|
function testListSites()
|
||||||
{
|
{
|
||||||
// Create a couple of sites
|
// Create a couple of sites
|
||||||
siteService.createSite("sitePreset", "siteShortName", "siteTitle", "siteDescription", true);
|
siteService.createSite("sitePreset", "siteShortName", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
|
||||||
siteService.createSite("sitePreset", "siteShortName2", "siteTitle", "siteDescription", true);
|
siteService.createSite("sitePreset", "siteShortName2", "siteTitle", "siteDescription", siteService.PUBLIC_SITE);
|
||||||
|
|
||||||
// List all the site
|
// List all the site
|
||||||
var sites = siteService.listSites(null, null);
|
var sites = siteService.listSites(null, null);
|
||||||
@@ -133,7 +133,7 @@ function testContainer()
|
|||||||
|
|
||||||
function testPermissions()
|
function testPermissions()
|
||||||
{
|
{
|
||||||
var site = siteService.createSite("sitePreset", "siteShortNameToo", "siteTitle", "siteDescription", false);
|
var site = siteService.createSite("sitePreset", "siteShortNameToo", "siteTitle", "siteDescription", siteService.PRIVATE_SITE);
|
||||||
test.assertNotNull(site);
|
test.assertNotNull(site);
|
||||||
var container = site.createContainer("test.permissions");
|
var container = site.createContainer("test.permissions");
|
||||||
test.assertNotNull(container);
|
test.assertNotNull(container);
|
||||||
@@ -164,7 +164,7 @@ function testRolesAndGroups()
|
|||||||
test.assertNotNull(roles);
|
test.assertNotNull(roles);
|
||||||
test.assertFalse(roles.length == 0);
|
test.assertFalse(roles.length == 0);
|
||||||
|
|
||||||
var site = siteService.createSite("sitePreset", "sn", "siteTitle", "siteDescription", false);
|
var site = siteService.createSite("sitePreset", "sn", "siteTitle", "siteDescription", siteService.PRIVATE_SITE);
|
||||||
var siteGroup = site.siteGroup;
|
var siteGroup = site.siteGroup;
|
||||||
test.assertNotNull(siteGroup);
|
test.assertNotNull(siteGroup);
|
||||||
test.assertEquals("GROUP_site_sn", siteGroup);
|
test.assertEquals("GROUP_site_sn", siteGroup);
|
||||||
|
@@ -28,7 +28,6 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import org.alfresco.mbeans.VirtServerRegistry;
|
import org.alfresco.mbeans.VirtServerRegistry;
|
||||||
import org.alfresco.repo.forms.FormService;
|
import org.alfresco.repo.forms.FormService;
|
||||||
import org.alfresco.repo.site.SiteService;
|
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.cmr.action.ActionService;
|
import org.alfresco.service.cmr.action.ActionService;
|
||||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
@@ -39,6 +38,7 @@ import org.alfresco.service.cmr.avm.locking.AVMLockingService;
|
|||||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
import org.alfresco.service.cmr.invitation.InvitationService;
|
||||||
import org.alfresco.service.cmr.lock.LockService;
|
import org.alfresco.service.cmr.lock.LockService;
|
||||||
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
|
||||||
import org.alfresco.service.cmr.ml.EditionService;
|
import org.alfresco.service.cmr.ml.EditionService;
|
||||||
@@ -59,6 +59,7 @@ import org.alfresco.service.cmr.security.AuthorityService;
|
|||||||
import org.alfresco.service.cmr.security.OwnableService;
|
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.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.alfresco.service.cmr.tagging.TaggingService;
|
import org.alfresco.service.cmr.tagging.TaggingService;
|
||||||
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
import org.alfresco.service.cmr.thumbnail.ThumbnailService;
|
||||||
import org.alfresco.service.cmr.version.VersionService;
|
import org.alfresco.service.cmr.version.VersionService;
|
||||||
@@ -135,6 +136,7 @@ public interface ServiceRegistry
|
|||||||
static final QName SANDBOX_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SandboxService");
|
static final QName SANDBOX_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "SandboxService");
|
||||||
static final QName ASSET_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AssetService");
|
static final QName ASSET_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AssetService");
|
||||||
static final QName FORM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FormService");
|
static final QName FORM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FormService");
|
||||||
|
static final QName INVITATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "InvitationService");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of services provided by the Repository
|
* Get the list of services provided by the Repository
|
||||||
@@ -456,4 +458,11 @@ public interface ServiceRegistry
|
|||||||
*/
|
*/
|
||||||
@NotAuditable
|
@NotAuditable
|
||||||
FormService getFormService();
|
FormService getFormService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the invitation service (or null if one is not provided)
|
||||||
|
* @return the invitation service
|
||||||
|
*/
|
||||||
|
@NotAuditable
|
||||||
|
InvitationService getInvitationService();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The invitation request is a command object for who, needs to be added or removed
|
||||||
|
* from which resource with which attributes.
|
||||||
|
*
|
||||||
|
* Invitations are processed by the InvitationService
|
||||||
|
*
|
||||||
|
* @see org.alfresco.service.cmr.invitation.InvitationService
|
||||||
|
*
|
||||||
|
* @author mrogers
|
||||||
|
*/
|
||||||
|
public interface Invitation
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* What sort of Resource Web Project, Web Site, Node
|
||||||
|
* (Just Web site for now)
|
||||||
|
*/
|
||||||
|
enum ResourceType
|
||||||
|
{
|
||||||
|
WEB_SITE
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What sort of resource is it, for example a WEB_SITE?
|
||||||
|
* @return the resource type
|
||||||
|
*/
|
||||||
|
public ResourceType getResourceType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What is the resource name ?
|
||||||
|
* @return the name of the resource
|
||||||
|
*/
|
||||||
|
public String getResourceName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Who is this invitation for ?
|
||||||
|
* @return the user name of the invitee
|
||||||
|
*/
|
||||||
|
public String getInviteeUserName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What is the unique reference for this invitation ?
|
||||||
|
* @return the unique reference for this invitation
|
||||||
|
*/
|
||||||
|
public String getInviteId();
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when there is a problem with an invitation.
|
||||||
|
*/
|
||||||
|
public class InvitationException extends AlfrescoRuntimeException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -3925105163386197586L;
|
||||||
|
|
||||||
|
public InvitationException(String msgId, Object ... args)
|
||||||
|
{
|
||||||
|
super(msgId, args);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current user has attempted to do something that they do not have
|
||||||
|
* the rights to do.
|
||||||
|
*/
|
||||||
|
public class InvitationExceptionForbidden extends InvitationException
|
||||||
|
{
|
||||||
|
|
||||||
|
public InvitationExceptionForbidden(String msg, Object[] args) {
|
||||||
|
super(msg, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvitationExceptionForbidden(String msgId) {
|
||||||
|
super(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3083631235637184401L;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The invitation does not exist.
|
||||||
|
*/
|
||||||
|
public class InvitationExceptionNotFound extends InvitationException
|
||||||
|
{
|
||||||
|
|
||||||
|
public InvitationExceptionNotFound(String msgId, Object[] args)
|
||||||
|
{
|
||||||
|
super(msgId, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6112400396903083597L;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current user has attempted to do something that is not valid.
|
||||||
|
*/
|
||||||
|
public class InvitationExceptionUserError extends InvitationException
|
||||||
|
{
|
||||||
|
|
||||||
|
public InvitationExceptionUserError(String msgId, Object[] args)
|
||||||
|
{
|
||||||
|
super(msgId, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -6112400396903083597L;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search criteria for invitation service
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface InvitationSearchCriteria
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* What type of invitations to search for ?
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum InvitationType
|
||||||
|
{
|
||||||
|
ALL,
|
||||||
|
MODERATED,
|
||||||
|
NOMINATED
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search by inviter (who started the invitation)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getInviter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search by invitee (who is being invited, alfresco userid)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getInvitee();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search by resource name
|
||||||
|
* @return the resource name
|
||||||
|
*/
|
||||||
|
String getResourceName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search by resource type
|
||||||
|
* @return the resource type
|
||||||
|
*/
|
||||||
|
Invitation.ResourceType getResourceType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do you want to search for moderated, nominated or all invitations ?
|
||||||
|
* @return the type to search for.
|
||||||
|
*/
|
||||||
|
InvitationType getInvitationType();
|
||||||
|
}
|
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The invitation service provides the ability to invite
|
||||||
|
* people to resources. For example adding a user to a shared web site.
|
||||||
|
*
|
||||||
|
* It manages the relationship between person, resource and requestType
|
||||||
|
* and may also pass along information such as who is to approve or the expected
|
||||||
|
* role of the user.
|
||||||
|
*
|
||||||
|
* @author mrogers
|
||||||
|
*/
|
||||||
|
public interface InvitationService
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the invitation process for a NominatedInvitation
|
||||||
|
*
|
||||||
|
* @param inviteeFirstName
|
||||||
|
* @param inviteeLastName
|
||||||
|
* @param inviteeEmail
|
||||||
|
* @param inviteeUserName the alfresco user name of the invitee, may be null for a new user
|
||||||
|
* @param Invitation.ResourceType resourceType
|
||||||
|
* @param resourceName
|
||||||
|
* @param inviteeRole
|
||||||
|
* @param serverPath
|
||||||
|
* @param acceptUrl
|
||||||
|
* @param rejectUrl
|
||||||
|
*
|
||||||
|
* @return the nominated invitation which will contain the invitationId and ticket which
|
||||||
|
* will uniquely identify this invitation.
|
||||||
|
*
|
||||||
|
* @throws InvitationException
|
||||||
|
* @throws InvitationExceptionUserError
|
||||||
|
* @throws InvitationExceptionForbidden
|
||||||
|
*/
|
||||||
|
public NominatedInvitation inviteNominated(
|
||||||
|
String inviteeFirstName,
|
||||||
|
String inviteeLastName,
|
||||||
|
String inviteeEmail,
|
||||||
|
String inviteeUserName,
|
||||||
|
Invitation.ResourceType resourceType,
|
||||||
|
String resourceName,
|
||||||
|
String inviteeRole,
|
||||||
|
String serverPath,
|
||||||
|
String acceptUrl,
|
||||||
|
String rejectUrl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the invitation process for a ModeratedInvitation
|
||||||
|
* @param inviteeUserName who is to be invited
|
||||||
|
* @param Invitation.ResourceType resourceType what resource type ?
|
||||||
|
* @param resourceName which resource
|
||||||
|
* @param inviteeRole which role ?
|
||||||
|
*/
|
||||||
|
public ModeratedInvitation inviteModerated(
|
||||||
|
String inviteeComments,
|
||||||
|
String inviteeUserName,
|
||||||
|
Invitation.ResourceType resourceType,
|
||||||
|
String resourceName,
|
||||||
|
String inviteeRole);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a Nominated Invitation invitee accepts this invitation
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param ticket
|
||||||
|
* @return the invitation
|
||||||
|
*/
|
||||||
|
public Invitation accept(String invitationId, String ticket);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moderator approves this invitation
|
||||||
|
*
|
||||||
|
* @param invitationId the request to approve
|
||||||
|
* @param reason - comments about the acceptance
|
||||||
|
*/
|
||||||
|
public Invitation approve(String invitationId, String reason);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User or moderator rejects this request
|
||||||
|
* @param invitationId
|
||||||
|
* @param reason
|
||||||
|
*/
|
||||||
|
public Invitation reject(String invitationId, String reason);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cancel this request
|
||||||
|
*/
|
||||||
|
public Invitation cancel (String invitationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get an invitation from its invitation id
|
||||||
|
*
|
||||||
|
* @param invitationId;
|
||||||
|
*/
|
||||||
|
public Invitation getInvitation(String invitationId) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list Invitations for a specific person
|
||||||
|
*/
|
||||||
|
public List<Invitation> listPendingInvitationsForInvitee(String invitee);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list Invitations for a specific resource
|
||||||
|
* @param resourceType
|
||||||
|
* @param resourceName
|
||||||
|
*/
|
||||||
|
public List<Invitation> listPendingInvitationsForResource(Invitation.ResourceType resourceType, String resourceName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* search invitation
|
||||||
|
*
|
||||||
|
* @param criteria
|
||||||
|
* @return the list of invitations
|
||||||
|
*/
|
||||||
|
public List<Invitation> searchInvitation(InvitationSearchCriteria criteria);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The moderated invitation request is a model object for who, needs to be added or removed
|
||||||
|
* from which resource with which attributes.
|
||||||
|
*
|
||||||
|
* Invitations are processed by the InvitationService
|
||||||
|
*
|
||||||
|
* @see org.alfresco.service.cmr.invitation.InvitationService
|
||||||
|
*
|
||||||
|
* @author mrogers
|
||||||
|
*/
|
||||||
|
public interface ModeratedInvitation extends Invitation
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Which resource to be invited to?
|
||||||
|
* @return the resource name.
|
||||||
|
*/
|
||||||
|
public String getResourceName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which role to be added with
|
||||||
|
* @return the roleName
|
||||||
|
*/
|
||||||
|
public String getRoleName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The invitee comments - why does the invitee want access ?
|
||||||
|
* @return invitee comments
|
||||||
|
*/
|
||||||
|
public String getInviteeComments();
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.invitation;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The nominated invitation is a model object for who, needs to be added or removed
|
||||||
|
* from which resource with which attributes.
|
||||||
|
*
|
||||||
|
* Invitations are processed by the InvitationService
|
||||||
|
*
|
||||||
|
* @see org.alfresco.service.cmr.invitation.InvitationService
|
||||||
|
*
|
||||||
|
* @author mrogers
|
||||||
|
*/
|
||||||
|
public interface NominatedInvitation extends Invitation
|
||||||
|
{
|
||||||
|
|
||||||
|
public String getInviteeFirstName();
|
||||||
|
|
||||||
|
public String getInviteeLastName();
|
||||||
|
|
||||||
|
public String getInviteeEmail();
|
||||||
|
|
||||||
|
public String getResourceName();
|
||||||
|
|
||||||
|
public String getServerPath();
|
||||||
|
|
||||||
|
public String getAcceptUrl();
|
||||||
|
|
||||||
|
public String getRejectUrl();
|
||||||
|
|
||||||
|
public Date getSentInviteDate();
|
||||||
|
|
||||||
|
public String getTicket();
|
||||||
|
|
||||||
|
public String getRoleName();
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,2 @@
|
|||||||
|
The interface for the invitation service.
|
||||||
|
|
106
source/java/org/alfresco/service/cmr/site/SiteInfo.java
Normal file
106
source/java/org/alfresco/service/cmr/site/SiteInfo.java
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
package org.alfresco.service.cmr.site;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
public interface SiteInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the site node reference
|
||||||
|
*
|
||||||
|
* @return NodeRef site node reference, null if not set
|
||||||
|
*/
|
||||||
|
public abstract NodeRef getNodeRef();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the site preset
|
||||||
|
*
|
||||||
|
* @return String site preset
|
||||||
|
*/
|
||||||
|
public abstract String getSitePreset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the short name
|
||||||
|
*
|
||||||
|
* @return String short name
|
||||||
|
*/
|
||||||
|
public abstract String getShortName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the title
|
||||||
|
*
|
||||||
|
* @return String site title
|
||||||
|
*/
|
||||||
|
public abstract String getTitle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the title
|
||||||
|
*
|
||||||
|
* @param title site title
|
||||||
|
*/
|
||||||
|
public abstract void setTitle(String title);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the description
|
||||||
|
*
|
||||||
|
* @return String site description
|
||||||
|
*/
|
||||||
|
public abstract String getDescription();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the description
|
||||||
|
*
|
||||||
|
* @param description site description
|
||||||
|
*/
|
||||||
|
public abstract void setDescription(String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this site is public or not. If true the visibility is set to "public", if false
|
||||||
|
* the visibility is set to "private"
|
||||||
|
*
|
||||||
|
* @param isPublic true public, false private
|
||||||
|
* @deprecated as of version 3.2, replaced by {@link #setVisibility(SiteVisibility)}
|
||||||
|
*/
|
||||||
|
public abstract void setIsPublic(boolean isPublic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the site is public.
|
||||||
|
*
|
||||||
|
* @return boolean true if public, false either private or moderated
|
||||||
|
* @deprecated as of version 3.2, replaced by {@link #getVisibility()}
|
||||||
|
*/
|
||||||
|
public abstract boolean getIsPublic();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the sites visibility
|
||||||
|
*
|
||||||
|
* @return SiteVisibility site visibility
|
||||||
|
*/
|
||||||
|
public abstract SiteVisibility getVisibility();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the sites visibility
|
||||||
|
*
|
||||||
|
* @param visibility site visibility
|
||||||
|
*/
|
||||||
|
public abstract void setVisibility(SiteVisibility visibility);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom property values
|
||||||
|
*
|
||||||
|
* @return Map<QName, Serializable> map of custom property names and values
|
||||||
|
*/
|
||||||
|
public abstract Map<QName, Serializable> getCustomProperties();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of a custom property
|
||||||
|
*
|
||||||
|
* @param name name of custom property
|
||||||
|
* @return Serializable value of the property, null if not set or doesn't exist
|
||||||
|
*/
|
||||||
|
public abstract Serializable getCustomProperty(QName name);
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package org.alfresco.repo.site;
|
package org.alfresco.service.cmr.site;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,11 +23,24 @@ public interface SiteService
|
|||||||
* @param shortName site short name, must be unique
|
* @param shortName site short name, must be unique
|
||||||
* @param title site title
|
* @param title site title
|
||||||
* @param description site description
|
* @param description site description
|
||||||
* @param isPublic whether the site is public or not
|
* @param isPublic whether the site is public or not (true = public, false = private)
|
||||||
* @return SiteInfo information about the created site
|
* @return SiteInfo information about the created site
|
||||||
|
* @deprecated since version 3.2, replaced by {@link #createSite(String, String, String, String, SiteVisibility)}
|
||||||
*/
|
*/
|
||||||
SiteInfo createSite(String sitePreset, String shortName, String title, String description, boolean isPublic);
|
SiteInfo createSite(String sitePreset, String shortName, String title, String description, boolean isPublic);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new site.
|
||||||
|
*
|
||||||
|
* @param sitePreset site preset name
|
||||||
|
* @param shortName site short name, must be unique
|
||||||
|
* @param title site title
|
||||||
|
* @param description site description
|
||||||
|
* @param visibility site visibility (public|moderated|private)
|
||||||
|
* @return SiteInfo information about the created site
|
||||||
|
*/
|
||||||
|
SiteInfo createSite(String sitePreset, String shortName, String title, String description, SiteVisibility visibility);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List the available sites. This list can optionally be filtered by site name and/or site preset.
|
* List the available sites. This list can optionally be filtered by site name and/or site preset.
|
||||||
*
|
*
|
||||||
@@ -58,7 +71,7 @@ public interface SiteService
|
|||||||
/**
|
/**
|
||||||
* Update the site information.
|
* Update the site information.
|
||||||
* <P>
|
* <P>
|
||||||
* Note that the shortname and sitepreset of a site can not be updated once the site has been created.
|
* Note that the short name and site preset of a site can not be updated once the site has been created.
|
||||||
*
|
*
|
||||||
* @param siteInfo site information
|
* @param siteInfo site information
|
||||||
*/
|
*/
|
||||||
@@ -72,51 +85,63 @@ public interface SiteService
|
|||||||
void deleteSite(String shortName);
|
void deleteSite(String shortName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List the memebers of the site.
|
* List the members of the site. This includes both users and groups.
|
||||||
* <p>
|
* <p>
|
||||||
* Name and role filters are optional and if not specified all the members of the site are returned.
|
* Name and role filters are optional and if not specified all the members of the site are returned.
|
||||||
*
|
*
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param nameFilter name filter
|
* @param nameFilter name filter
|
||||||
* @param roleFilter role filter
|
* @param roleFilter role filter
|
||||||
* @return Map<String, String> the username and their role
|
* @return Map<String, String> the authority name and their role
|
||||||
*/
|
*/
|
||||||
Map<String, String> listMembers(String shortName, String nameFilter, String roleFilter);
|
Map<String, String> listMembers(String shortName, String nameFilter, String roleFilter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the role of the specified user
|
* List the members of the site. This includes both users and groups if collapseGroups is set to false, otherwise all
|
||||||
|
* groups that are members are collapsed into their component users and listed.
|
||||||
|
*
|
||||||
|
* @param shortName site short name
|
||||||
|
* @param nameFilter name filter
|
||||||
|
* @param roleFilter role filter
|
||||||
|
* @param collapseGroups true if collapse member groups into user list, false otherwise
|
||||||
|
* @return Map<String, String> the authority name and their role
|
||||||
|
*/
|
||||||
|
Map<String, String> listMembers(String shortName, String nameFilter, String roleFilter, boolean collapseGroups);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the role of the specified user.
|
||||||
*
|
*
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param userName user name
|
* @param authorityName authority name
|
||||||
* @return String site role, null if none
|
* @return String site role, null if none
|
||||||
*/
|
*/
|
||||||
String getMembersRole(String shortName, String userName);
|
String getMembersRole(String shortName, String authorityName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inidiactes whether a user is a member of a site or not
|
* Indicates whether an authority is a member of a site or not
|
||||||
*
|
*
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param userName user name
|
* @param authorityName authority name
|
||||||
* @return boolean true if the user is a member of the site, false otherwise
|
* @return boolean true if the authority is a member of the site, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isMember(String shortName, String userName);
|
boolean isMember(String shortName, String authorityName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the role of a user withint a site
|
* Sets the role of an authority within a site
|
||||||
*
|
*
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param userName user name
|
* @param authorityName authority name
|
||||||
* @param role site role
|
* @param role site role
|
||||||
*/
|
*/
|
||||||
void setMembership(String shortName, String userName, String role);
|
void setMembership(String shortName, String authorityName, String role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears a users role within a site
|
* Clears an authorities role within a site
|
||||||
*
|
*
|
||||||
* @param shortName site short name
|
* @param shortName site short name
|
||||||
* @param userName user name
|
* @param authorityName authority name
|
||||||
*/
|
*/
|
||||||
void removeMembership(String shortName, String userName);
|
void removeMembership(String shortName, String authorityName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a container for a component is a site of the given container type (must be a sub-type of st:siteContainer)
|
* Creates a container for a component is a site of the given container type (must be a sub-type of st:siteContainer)
|
||||||
@@ -157,7 +182,7 @@ public interface SiteService
|
|||||||
/**
|
/**
|
||||||
* Gets a list of all the currently available roles that a user can perform on a site
|
* Gets a list of all the currently available roles that a user can perform on a site
|
||||||
*
|
*
|
||||||
* @return List<String> list of availble roles
|
* @return List<String> list of available roles
|
||||||
*/
|
*/
|
||||||
List<String> getSiteRoles();
|
List<String> getSiteRoles();
|
||||||
|
|
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.cmr.site;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumeration representing the different site visibilities.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public enum SiteVisibility
|
||||||
|
{
|
||||||
|
PUBLIC, // Public site. Visible and accessible by all
|
||||||
|
MODERATED, // Moderated site. Visible to all, but only accessible via moderated invitation.
|
||||||
|
PRIVATE // Private site. Visible and accessible only to members of the site.
|
||||||
|
}
|
Reference in New Issue
Block a user