mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Added document level security
Fixed AWC-407 Added helper to Application to get client config git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2114 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,6 +39,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.web.app.servlet.AuthenticationHelper;
|
||||
import org.alfresco.web.bean.ErrorBean;
|
||||
import org.alfresco.web.bean.repository.User;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
import org.alfresco.web.config.ServerConfigElement;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
@@ -546,6 +547,18 @@ public class Application
|
||||
Application.BEAN_CONFIG_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the client config element from the config service
|
||||
*
|
||||
* @param context FacesContext
|
||||
* @return The ClientConfigElement
|
||||
*/
|
||||
public static ClientConfigElement getClientConfig(FacesContext context)
|
||||
{
|
||||
return (ClientConfigElement)getConfigService(context).getGlobalConfig().
|
||||
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the repository store URL
|
||||
*
|
||||
|
@@ -1213,9 +1213,7 @@ public class AdvancedSearchBean
|
||||
{
|
||||
if (clientConfigElement == null)
|
||||
{
|
||||
ConfigService configService = Application.getConfigService(FacesContext.getCurrentInstance());
|
||||
clientConfigElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement(
|
||||
ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
clientConfigElement = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
}
|
||||
return clientConfigElement;
|
||||
}
|
||||
|
@@ -1245,10 +1245,7 @@ public class BrowseBean implements IContextListener
|
||||
*/
|
||||
private void initFromClientConfig()
|
||||
{
|
||||
this.clientConfig = (ClientConfigElement)Application.getConfigService(
|
||||
FacesContext.getCurrentInstance()).getGlobalConfig().
|
||||
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
|
||||
this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
this.browseViewMode = clientConfig.getDefaultView(PAGE_NAME_BROWSE);
|
||||
this.browsePageSize = clientConfig.getDefaultPageSize(PAGE_NAME_BROWSE,
|
||||
this.browseViewMode);
|
||||
|
@@ -952,22 +952,20 @@ public class ForumsBean implements IContextListener
|
||||
*/
|
||||
private void initFromClientConfig()
|
||||
{
|
||||
this.clientConfig = (ClientConfigElement)Application.getConfigService(
|
||||
FacesContext.getCurrentInstance()).getGlobalConfig().
|
||||
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
|
||||
// get the defaults for the forums page
|
||||
this.forumsViewMode = clientConfig.getDefaultView(PAGE_NAME_FORUMS);
|
||||
this.forumsViewMode = this.clientConfig.getDefaultView(PAGE_NAME_FORUMS);
|
||||
this.forumsPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUMS,
|
||||
this.forumsViewMode);
|
||||
|
||||
// get the default for the forum page
|
||||
this.forumViewMode = clientConfig.getDefaultView(PAGE_NAME_FORUM);
|
||||
this.forumViewMode = this.clientConfig.getDefaultView(PAGE_NAME_FORUM);
|
||||
this.forumPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUM,
|
||||
this.forumViewMode);
|
||||
|
||||
// get the default for the topic page
|
||||
this.topicViewMode = clientConfig.getDefaultView(PAGE_NAME_TOPIC);
|
||||
this.topicViewMode = this.clientConfig.getDefaultView(PAGE_NAME_TOPIC);
|
||||
this.topicPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_TOPIC,
|
||||
this.topicViewMode);
|
||||
|
||||
|
@@ -540,10 +540,7 @@ public class NavigationBean
|
||||
*/
|
||||
private void initFromClientConfig()
|
||||
{
|
||||
this.clientConfig = (ClientConfigElement)Application.getConfigService(
|
||||
FacesContext.getCurrentInstance()).getGlobalConfig().
|
||||
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
|
||||
this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
this.helpUrl = clientConfig.getHelpUrl();
|
||||
this.shelfExpanded = clientConfig.isShelfVisible();
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package org.alfresco.web.bean.users;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Concrete implementation providing access to users of the current content/document.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class ContentUsersBean extends UserMembersBean
|
||||
{
|
||||
/**
|
||||
* @return The space to work against
|
||||
*/
|
||||
public Node getNode()
|
||||
{
|
||||
return this.browseBean.getDocument();
|
||||
}
|
||||
}
|
19
source/java/org/alfresco/web/bean/users/SpaceUsersBean.java
Normal file
19
source/java/org/alfresco/web/bean/users/SpaceUsersBean.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.alfresco.web.bean.users;
|
||||
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Concrete implementation providing access to users of the current space.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class SpaceUsersBean extends UserMembersBean
|
||||
{
|
||||
/**
|
||||
* @return The space to work against
|
||||
*/
|
||||
public Node getNode()
|
||||
{
|
||||
return this.browseBean.getActionSpace();
|
||||
}
|
||||
}
|
@@ -45,12 +45,10 @@ import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.UIContextService;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.repository.MapNode;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.repository.User;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.data.UIRichList;
|
||||
@@ -59,7 +57,7 @@ import org.alfresco.web.ui.repo.WebResources;
|
||||
/**
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class UserMembersBean
|
||||
public abstract class UserMembersBean
|
||||
{
|
||||
private static final String MSG_SUCCESS_INHERIT_NOT = "success_not_inherit_permissions";
|
||||
private static final String MSG_SUCCESS_INHERIT = "success_inherit_permissions";
|
||||
@@ -69,22 +67,22 @@ public class UserMembersBean
|
||||
private static final String OUTCOME_FINISH = "finish";
|
||||
|
||||
/** NodeService bean reference */
|
||||
private NodeService nodeService;
|
||||
protected NodeService nodeService;
|
||||
|
||||
/** SearchService bean reference */
|
||||
private SearchService searchService;
|
||||
protected SearchService searchService;
|
||||
|
||||
/** PermissionService bean reference */
|
||||
private PermissionService permissionService;
|
||||
protected PermissionService permissionService;
|
||||
|
||||
/** PersonService bean reference */
|
||||
private PersonService personService;
|
||||
protected PersonService personService;
|
||||
|
||||
/** BrowseBean bean refernce */
|
||||
private BrowseBean browseBean;
|
||||
protected BrowseBean browseBean;
|
||||
|
||||
/** OwnableService bean reference */
|
||||
private OwnableService ownableService;
|
||||
protected OwnableService ownableService;
|
||||
|
||||
/** Component reference for Users RichList control */
|
||||
private UIRichList usersRichList;
|
||||
@@ -101,6 +99,15 @@ public class UserMembersBean
|
||||
/** roles for current person */
|
||||
private List<PermissionWrapper> personRoles = null;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Abstract methods
|
||||
|
||||
/**
|
||||
* Returns the node that is being acted upon
|
||||
*
|
||||
* @return The node to manage permissions for
|
||||
*/
|
||||
public abstract Node getNode();
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean property getters and setters
|
||||
@@ -153,14 +160,6 @@ public class UserMembersBean
|
||||
this.browseBean = browseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The space to work against
|
||||
*/
|
||||
public Node getSpace()
|
||||
{
|
||||
return this.browseBean.getActionSpace();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the usersRichList.
|
||||
*/
|
||||
@@ -234,7 +233,7 @@ public class UserMembersBean
|
||||
*/
|
||||
public boolean getHasChangePermissions()
|
||||
{
|
||||
return getSpace().hasPermission(PermissionService.CHANGE_PERMISSIONS);
|
||||
return getNode().hasPermission(PermissionService.CHANGE_PERMISSIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,7 +241,7 @@ public class UserMembersBean
|
||||
*/
|
||||
public boolean isInheritPermissions()
|
||||
{
|
||||
return this.permissionService.getInheritParentPermissions(getSpace().getNodeRef());
|
||||
return this.permissionService.getInheritParentPermissions(getNode().getNodeRef());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,7 +257,7 @@ public class UserMembersBean
|
||||
*/
|
||||
public String getOwner()
|
||||
{
|
||||
return this.ownableService.getOwner(getSpace().getNodeRef());
|
||||
return this.ownableService.getOwner(getNode().getNodeRef());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,9 +278,8 @@ public class UserMembersBean
|
||||
// Return all the permissions set against the current node
|
||||
// for any authentication instance (user).
|
||||
// Then combine them into a single list for each authentication found.
|
||||
User user = Application.getCurrentUser(context);
|
||||
Map<String, List<String>> permissionMap = new HashMap<String, List<String>>(13, 1.0f);
|
||||
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(getSpace().getNodeRef());
|
||||
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(getNode().getNodeRef());
|
||||
if (permissions != null)
|
||||
{
|
||||
for (AccessPermission permission : permissions)
|
||||
@@ -326,8 +324,7 @@ public class UserMembersBean
|
||||
// it is much better for performance to do this now rather than during page bind
|
||||
Map<String, Object> props = node.getProperties();
|
||||
props.put("fullName", ((String)props.get("firstName")) + ' ' + ((String)props.get("lastName")));
|
||||
|
||||
String userName = (String)props.get("userName");
|
||||
|
||||
props.put("roles", listToString(context, permissionMap.get(authority)));
|
||||
|
||||
props.put("icon", WebResources.IMAGE_PERSON);
|
||||
@@ -426,7 +423,7 @@ public class UserMembersBean
|
||||
|
||||
// setup roles for this Authority
|
||||
List<PermissionWrapper> userPermissions = new ArrayList<PermissionWrapper>(4);
|
||||
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(getSpace().getNodeRef());
|
||||
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(getNode().getNodeRef());
|
||||
if (permissions != null)
|
||||
{
|
||||
for (AccessPermission permission : permissions)
|
||||
@@ -471,7 +468,7 @@ public class UserMembersBean
|
||||
{
|
||||
// change the value to the new selected value
|
||||
boolean inheritPermissions = (Boolean)event.getNewValue();
|
||||
this.permissionService.setInheritParentPermissions(getSpace().getNodeRef(), inheritPermissions);
|
||||
this.permissionService.setInheritParentPermissions(getNode().getNodeRef(), inheritPermissions);
|
||||
|
||||
// inform the user that the change occured
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
@@ -542,7 +539,7 @@ public class UserMembersBean
|
||||
|
||||
// clear the currently set permissions for this user
|
||||
// and add each of the new permissions in turn
|
||||
NodeRef nodeRef = getSpace().getNodeRef();
|
||||
NodeRef nodeRef = getNode().getNodeRef();
|
||||
this.permissionService.clearPermission(nodeRef, getPersonAuthority());
|
||||
for (PermissionWrapper wrapper : personRoles)
|
||||
{
|
||||
@@ -585,7 +582,7 @@ public class UserMembersBean
|
||||
if (getPersonAuthority() != null)
|
||||
{
|
||||
// clear permissions for the specified Authority
|
||||
this.permissionService.clearPermission(getSpace().getNodeRef(), getPersonAuthority());
|
||||
this.permissionService.clearPermission(getNode().getNodeRef(), getPersonAuthority());
|
||||
}
|
||||
|
||||
// commit the transaction
|
||||
|
@@ -0,0 +1,66 @@
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Concrete implementation providing the ability to invite users to content.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class InviteContentUsersWizard extends InviteUsersWizard
|
||||
{
|
||||
private static final String WIZARD_TITLE_ID = "invite_content_title";
|
||||
private static final String WIZARD_DESC_ID = "invite_content_desc";
|
||||
private static final String STEP1_DESCRIPTION_ID = "invite_content_step1_desc";
|
||||
|
||||
/** Cache of available content permissions */
|
||||
Set<String> contentPermissions = null;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription()
|
||||
*/
|
||||
public String getWizardDescription()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle()
|
||||
*/
|
||||
public String getWizardTitle()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStep1DescriptionText()
|
||||
{
|
||||
return STEP1_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getPermissionsForType()
|
||||
{
|
||||
if (this.contentPermissions == null)
|
||||
{
|
||||
// TODO: This should really request permissions from TYPE_CONTENT but there are other permissions
|
||||
// defined at that level at the moment that get exposed when we don't want them to, see
|
||||
// http://www.alfresco.org/jira/browse/AR-343
|
||||
this.contentPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_CMOBJECT);
|
||||
}
|
||||
|
||||
return this.contentPermissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node getNode()
|
||||
{
|
||||
return this.browseBean.getDocument();
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Concrete implementation providing the ability to invite users to a space.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class InviteSpaceUsersWizard extends InviteUsersWizard
|
||||
{
|
||||
private static final String WIZARD_TITLE_ID = "invite_title";
|
||||
private static final String WIZARD_DESC_ID = "invite_desc";
|
||||
private static final String STEP1_DESCRIPTION_ID = "invite_step1_desc";
|
||||
|
||||
/** Cache of available folder permissions */
|
||||
Set<String> folderPermissions = null;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription()
|
||||
*/
|
||||
public String getWizardDescription()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle()
|
||||
*/
|
||||
public String getWizardTitle()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStep1DescriptionText()
|
||||
{
|
||||
return STEP1_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getPermissionsForType()
|
||||
{
|
||||
if (this.folderPermissions == null)
|
||||
{
|
||||
this.folderPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_FOLDER);
|
||||
}
|
||||
|
||||
return this.folderPermissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node getNode()
|
||||
{
|
||||
return this.browseBean.getActionSpace();
|
||||
}
|
||||
}
|
@@ -54,19 +54,16 @@ import org.springframework.mail.javamail.JavaMailSender;
|
||||
/**
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class InviteUsersWizard extends AbstractWizardBean
|
||||
public abstract class InviteUsersWizard extends AbstractWizardBean
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(InviteUsersWizard.class);
|
||||
|
||||
/** I18N message strings */
|
||||
private static final String MSG_USERS = "users";
|
||||
private static final String MSG_GROUPS = "groups";
|
||||
private static final String MSG_INVITED_SPACE = "invite_space";
|
||||
private static final String MSG_INVITED_TO = "invited_to";
|
||||
private static final String MSG_INVITED_ROLE = "invite_role";
|
||||
private static final String WIZARD_TITLE_ID = "invite_title";
|
||||
private static final String WIZARD_DESC_ID = "invite_desc";
|
||||
private static final String STEP1_TITLE_ID = "invite_step1_title";
|
||||
private static final String STEP1_DESCRIPTION_ID = "invite_step1_desc";
|
||||
private static final String STEP2_TITLE_ID = "invite_step2_title";
|
||||
private static final String STEP2_DESCRIPTION_ID = "invite_step2_desc";
|
||||
private static final String FINISH_INSTRUCTION_ID = "invite_finish_instruction";
|
||||
@@ -74,19 +71,19 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
private static final String NOTIFY_YES = "yes";
|
||||
|
||||
/** NamespaceService bean reference */
|
||||
private NamespaceService namespaceService;
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
/** JavaMailSender bean reference */
|
||||
private JavaMailSender mailSender;
|
||||
protected JavaMailSender mailSender;
|
||||
|
||||
/** AuthorityService bean reference */
|
||||
private AuthorityService authorityService;
|
||||
protected AuthorityService authorityService;
|
||||
|
||||
/** PermissionService bean reference */
|
||||
private PermissionService permissionService;
|
||||
protected PermissionService permissionService;
|
||||
|
||||
/** personService bean reference */
|
||||
private PersonService personService;
|
||||
protected PersonService personService;
|
||||
|
||||
/** datamodel for table of roles for users */
|
||||
private DataModel userRolesDataModel = null;
|
||||
@@ -94,9 +91,6 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
/** list of user/group role wrapper objects */
|
||||
private List<UserGroupRole> userGroupRoles = null;
|
||||
|
||||
/** Cache of available folder permissions */
|
||||
Set<String> folderPermissions = null;
|
||||
|
||||
/** dialog state */
|
||||
private String notify = NOTIFY_YES;
|
||||
private String subject = null;
|
||||
@@ -104,6 +98,20 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
private String internalSubject = null;
|
||||
private String automaticText = null;
|
||||
|
||||
/**
|
||||
* @return a cached list of available permissions for the type being dealt with
|
||||
*/
|
||||
protected abstract Set<String> getPermissionsForType();
|
||||
|
||||
/**
|
||||
* @return Returns the node that the permissions are being applied to
|
||||
*/
|
||||
protected abstract Node getNode();
|
||||
|
||||
/**
|
||||
* @return The text to use for the description of step 1 (depends on the type being dealt with)
|
||||
*/
|
||||
protected abstract String getStep1DescriptionText();
|
||||
|
||||
/**
|
||||
* @param namespaceService The NamespaceService to set.
|
||||
@@ -186,12 +194,12 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
String from = (String)this.nodeService.getProperty(user.getPerson(), ContentModel.PROP_EMAIL);
|
||||
if (from == null || from.length() == 0)
|
||||
{
|
||||
// TODO: get this from spring config?
|
||||
from = "alfresco@alfresco.org";
|
||||
// if the user does not have an email address get the default one from the config service
|
||||
from = Application.getClientConfig(context).getFromEmailAddress();
|
||||
}
|
||||
|
||||
// get the Space to apply changes too
|
||||
NodeRef folderNodeRef = this.browseBean.getActionSpace().getNodeRef();
|
||||
NodeRef nodeRef = this.getNode().getNodeRef();
|
||||
|
||||
// set permissions for each user and send them a mail
|
||||
for (int i=0; i<this.userGroupRoles.size(); i++)
|
||||
@@ -200,13 +208,13 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
String authority = userGroupRole.getAuthority();
|
||||
|
||||
// find the selected permission ref from it's name and apply for the specified user
|
||||
Set<String> perms = getFolderPermissions();
|
||||
Set<String> perms = getPermissionsForType();
|
||||
for (String permission : perms)
|
||||
{
|
||||
if (userGroupRole.getRole().equals(permission))
|
||||
{
|
||||
this.permissionService.setPermission(
|
||||
folderNodeRef,
|
||||
nodeRef,
|
||||
authority,
|
||||
permission,
|
||||
true);
|
||||
@@ -223,7 +231,7 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
{
|
||||
if (this.personService.personExists(authority) == true)
|
||||
{
|
||||
notifyUser(this.personService.getPerson(authority), folderNodeRef, from, userGroupRole.getRole());
|
||||
notifyUser(this.personService.getPerson(authority), nodeRef, from, userGroupRole.getRole());
|
||||
}
|
||||
}
|
||||
else if (authType.equals(AuthorityType.GROUP))
|
||||
@@ -234,7 +242,7 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
{
|
||||
if (this.personService.personExists(userAuth) == true)
|
||||
{
|
||||
notifyUser(this.personService.getPerson(userAuth), folderNodeRef, from, userGroupRole.getRole());
|
||||
notifyUser(this.personService.getPerson(userAuth), nodeRef, from, userGroupRole.getRole());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,11 +270,11 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
* Send an email notification to the specified User authority
|
||||
*
|
||||
* @param person Person node representing the user
|
||||
* @param folder Folder node they are invited too
|
||||
* @param node Node they are invited too
|
||||
* @param from From text message
|
||||
* @param roleText The role display label for the user invite notification
|
||||
*/
|
||||
private void notifyUser(NodeRef person, NodeRef folder, String from, String roleText)
|
||||
private void notifyUser(NodeRef person, NodeRef node, String from, String roleText)
|
||||
{
|
||||
String to = (String)this.nodeService.getProperty(person, ContentModel.PROP_EMAIL);
|
||||
|
||||
@@ -275,10 +283,10 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
String msgRole = Application.getMessage(FacesContext.getCurrentInstance(), MSG_INVITED_ROLE);
|
||||
String roleMessage = MessageFormat.format(msgRole, new Object[] {roleText});
|
||||
|
||||
// TODO: include External Authentication link to the invited space
|
||||
//String args = folder.getStoreRef().getProtocol() + '/' +
|
||||
// folder.getStoreRef().getIdentifier() + '/' +
|
||||
// folder.getId();
|
||||
// TODO: include External Authentication link to the invited node
|
||||
//String args = node.getStoreRef().getProtocol() + '/' +
|
||||
// node.getStoreRef().getIdentifier() + '/' +
|
||||
// node.getId();
|
||||
//String url = ExternalAccessServlet.generateExternalURL(LoginBean.OUTCOME_SPACEDETAILS, args);
|
||||
|
||||
String body = this.internalSubject + "\r\n\r\n" + roleMessage + "\r\n\r\n";// + url + "\r\n\r\n";
|
||||
@@ -513,7 +521,7 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||
|
||||
// get available roles (grouped permissions) from the permission service
|
||||
Set<String> perms = getFolderPermissions();
|
||||
Set<String> perms = getPermissionsForType();
|
||||
SelectItem[] roles = new SelectItem[perms.size()];
|
||||
int index = 0;
|
||||
for (String permission : perms)
|
||||
@@ -590,22 +598,6 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardDescription()
|
||||
*/
|
||||
public String getWizardDescription()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_DESC_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getWizardTitle()
|
||||
*/
|
||||
public String getWizardTitle()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), WIZARD_TITLE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#getStepDescription()
|
||||
*/
|
||||
public String getStepDescription()
|
||||
@@ -616,7 +608,7 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), STEP1_DESCRIPTION_ID);
|
||||
stepDesc = Application.getMessage(FacesContext.getCurrentInstance(), getStep1DescriptionText());
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
@@ -699,10 +691,10 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
|
||||
String personName = Application.getCurrentUser(context).getFullName(getNodeService());
|
||||
String msgInvite = Application.getMessage(context, MSG_INVITED_SPACE);
|
||||
Node node = this.browseBean.getActionSpace();
|
||||
String msgInvitedTo = Application.getMessage(context, MSG_INVITED_TO);
|
||||
Node node = this.getNode();
|
||||
String path = this.nodeService.getPath(node.getNodeRef()).toDisplayPath(this.nodeService);
|
||||
buf.append(MessageFormat.format(msgInvite, new Object[] {
|
||||
buf.append(MessageFormat.format(msgInvitedTo, new Object[] {
|
||||
path + '/' + node.getName(),
|
||||
personName}) );
|
||||
|
||||
@@ -756,21 +748,7 @@ public class InviteUsersWizard extends AbstractWizardBean
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a cached list of available folder permissions
|
||||
*/
|
||||
private Set<String> getFolderPermissions()
|
||||
{
|
||||
if (this.folderPermissions == null)
|
||||
{
|
||||
this.folderPermissions = this.permissionService.getSettablePermissions(ContentModel.TYPE_FOLDER);
|
||||
}
|
||||
|
||||
return this.folderPermissions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple wrapper class to represent a user/group and a role combination
|
||||
|
@@ -44,6 +44,7 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
private String defaultView = "details";
|
||||
private String defaultSortColumn = "name";
|
||||
private String defaultSortOrder = "ascending";
|
||||
private String fromEmailAddress = "alfresco@alfresco.org";
|
||||
|
||||
// list to store all the configured views
|
||||
private List<String> views = new ArrayList<String>(4);
|
||||
@@ -323,6 +324,23 @@ public class ClientConfigElement extends ConfigElementAdapter
|
||||
this.helpUrl = helpUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the from email address, if one has not been set
|
||||
* alfresco@alfresco.org will be returned
|
||||
*/
|
||||
public String getFromEmailAddress()
|
||||
{
|
||||
return this.fromEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fromEmailAddress The from email address to set
|
||||
*/
|
||||
/*package*/ void setFromEmailAddress(String fromEmailAddress)
|
||||
{
|
||||
this.fromEmailAddress = fromEmailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the edit link type.
|
||||
*/
|
||||
|
@@ -55,6 +55,7 @@ public class ClientElementReader implements ConfigElementReader
|
||||
public static final String ELEMENT_TYPE = "type";
|
||||
public static final String ELEMENT_CUSTOMPROPS = "custom-properties";
|
||||
public static final String ELEMENT_METADATA = "meta-data";
|
||||
public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address";
|
||||
public static final String ATTRIBUTE_TYPE = "type";
|
||||
public static final String ATTRIBUTE_PROPERTY = "property";
|
||||
public static final String ATTRIBUTE_ASPECT = "aspect";
|
||||
@@ -200,6 +201,13 @@ public class ClientElementReader implements ConfigElementReader
|
||||
configElement.setHomeSpacePermission(permission.getTextTrim());
|
||||
}
|
||||
|
||||
// get the from address to use when sending emails from the client
|
||||
Element fromEmail = element.element(ELEMENT_FROMEMAILADDRESS);
|
||||
if (fromEmail != null)
|
||||
{
|
||||
configElement.setFromEmailAddress(fromEmail.getTextTrim());
|
||||
}
|
||||
|
||||
// get the Advanced Search config block
|
||||
Element advsearch = element.element(ELEMENT_ADVANCEDSEARCH);
|
||||
if (advsearch != null)
|
||||
|
@@ -136,9 +136,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements
|
||||
private void createComponentsFromConfig(FacesContext context)
|
||||
{
|
||||
DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService();
|
||||
ConfigService configService = Application.getConfigService(context);
|
||||
ClientConfigElement clientConfig = (ClientConfigElement)configService.getGlobalConfig().getConfigElement(
|
||||
ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
ClientConfigElement clientConfig = Application.getClientConfig(context);
|
||||
|
||||
// create an appropriate component for each custom property
|
||||
// using the DataDictionary to look-up labels and value types
|
||||
|
@@ -24,7 +24,6 @@ import java.util.Map;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.el.ValueBinding;
|
||||
|
||||
import org.alfresco.config.ConfigService;
|
||||
import org.alfresco.repo.template.DateCompareMethod;
|
||||
import org.alfresco.repo.template.HasAspectMethod;
|
||||
import org.alfresco.repo.template.I18NMessageMethod;
|
||||
@@ -37,7 +36,6 @@ import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.repository.User;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -113,11 +111,6 @@ public class UITemplate extends SelfRenderingComponent
|
||||
// get the data model to use - building default if required
|
||||
Object model = getModel();
|
||||
|
||||
// get the configservice to find the appropriate processor
|
||||
ConfigService service = Application.getConfigService(context);
|
||||
ClientConfigElement clientConfig = (ClientConfigElement)service.getGlobalConfig().getConfigElement(
|
||||
ClientConfigElement.CONFIG_ELEMENT_ID);
|
||||
|
||||
// get the template to process
|
||||
String template = getTemplate();
|
||||
if (template != null && template.length() != 0)
|
||||
|
Reference in New Issue
Block a user