. Fix for issue identified by Steve on Friday

- to handle that "Guest" is not Person from personService.personExists() but it is a Person if you call personService.getPerson()… (very odd)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2351 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-02-12 17:45:52 +00:00
parent ec63a96311
commit 11493da0c4
4 changed files with 18 additions and 10 deletions

View File

@@ -529,7 +529,8 @@ public final class Repository
// this will also force initialisation of the props now during the UserTransaction // this will also force initialisation of the props now during the UserTransaction
// it is much better for performance to do this now rather than during page bind // it is much better for performance to do this now rather than during page bind
Map<String, Object> props = node.getProperties(); Map<String, Object> props = node.getProperties();
props.put("fullName", ((String)props.get("firstName")) + ' ' + ((String)props.get("lastName"))); String lastName = (String)props.get("lastName");
props.put("fullName", ((String)props.get("firstName")) + ' ' + (lastName != null ? lastName : ""));
NodeRef homeFolderNodeRef = (NodeRef)props.get("homeFolder"); NodeRef homeFolderNodeRef = (NodeRef)props.get("homeFolder");
if (homeFolderNodeRef != null) if (homeFolderNodeRef != null)
{ {

View File

@@ -84,8 +84,9 @@ public final class User
{ {
if (this.fullName == null) if (this.fullName == null)
{ {
this.fullName = service.getProperty(this.person, ContentModel.PROP_FIRSTNAME) + " " + String lastName = (String)service.getProperty(this.person, ContentModel.PROP_LASTNAME);
service.getProperty(this.person, ContentModel.PROP_LASTNAME); this.fullName = service.getProperty(this.person, ContentModel.PROP_FIRSTNAME) +
(lastName != null ? (" " + lastName) : "");
} }
return this.fullName; return this.fullName;

View File

@@ -312,7 +312,8 @@ public abstract class UserMembersBean
for (String authority : permissionMap.keySet()) for (String authority : permissionMap.keySet())
{ {
// check if we are dealing with a person (User Authority) // check if we are dealing with a person (User Authority)
if (personService.personExists(authority)) if (AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST ||
personService.personExists(authority))
{ {
NodeRef nodeRef = personService.getPerson(authority); NodeRef nodeRef = personService.getPerson(authority);
if (nodeRef != null) if (nodeRef != null)
@@ -325,9 +326,7 @@ public abstract class UserMembersBean
// it is much better for performance to do this now rather than during page bind // it is much better for performance to do this now rather than during page bind
Map<String, Object> props = node.getProperties(); Map<String, Object> props = node.getProperties();
props.put("fullName", ((String)props.get("firstName")) + ' ' + ((String)props.get("lastName"))); props.put("fullName", ((String)props.get("firstName")) + ' ' + ((String)props.get("lastName")));
props.put("roles", listToString(context, permissionMap.get(authority))); props.put("roles", listToString(context, permissionMap.get(authority)));
props.put("icon", WebResources.IMAGE_PERSON); props.put("icon", WebResources.IMAGE_PERSON);
personNodes.add(node); personNodes.add(node);
@@ -337,7 +336,14 @@ public abstract class UserMembersBean
{ {
// need a map (dummy node) to represent props for this Group Authority // need a map (dummy node) to represent props for this Group Authority
Map<String, Object> node = new HashMap<String, Object>(5, 1.0f); Map<String, Object> node = new HashMap<String, Object>(5, 1.0f);
node.put("fullName", authority.substring(PermissionService.GROUP_PREFIX.length())); if (authority.startsWith(PermissionService.GROUP_PREFIX) == true)
{
node.put("fullName", authority.substring(PermissionService.GROUP_PREFIX.length()));
}
else
{
node.put("fullName", authority);
}
node.put("userName", authority); node.put("userName", authority);
node.put("id", authority); node.put("id", authority);
node.put("roles", listToString(context, permissionMap.get(authority))); node.put("roles", listToString(context, permissionMap.get(authority)));

View File

@@ -457,9 +457,9 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
// build a display label showing the user and their role for the space // build a display label showing the user and their role for the space
AuthorityType authType = AuthorityType.getAuthorityType(authority); AuthorityType authType = AuthorityType.getAuthorityType(authority);
if (authType.equals(AuthorityType.USER) || authType.equals(AuthorityType.GUEST)) if (authType == AuthorityType.GUEST || authType == AuthorityType.USER)
{ {
if (this.personService.personExists(authority) == true) if (authType == AuthorityType.GUEST || this.personService.personExists(authority) == true)
{ {
// found a User authority // found a User authority
NodeRef ref = this.personService.getPerson(authority); NodeRef ref = this.personService.getPerson(authority);
@@ -468,7 +468,7 @@ public abstract class InviteUsersWizard extends AbstractWizardBean
label.append(firstName) label.append(firstName)
.append(" ") .append(" ")
.append(lastName) .append(lastName != null ? lastName : "")
.append(" (") .append(" (")
.append(Application.getMessage(FacesContext.getCurrentInstance(), role)) .append(Application.getMessage(FacesContext.getCurrentInstance(), role))
.append(")"); .append(")");