From 1fcbb2eca22d1f2b5e4e46963ac1fbf84a5f2bba Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 18 Jul 2008 15:06:58 +0000 Subject: [PATCH] First cut of User Profile component - basic Edit Form and layout at present, displays User props such as name, location, biography etc. - TBD: read only view (which will be the initial view), Save Changes, Upload photo. Alfresco Share logo added to slingshot header area. Improvements to user meta-data retrieval to return content strings if content properties are found. AlfrescoUserFactory now retrieves user bio property. Enhanced FreeMarker template API - added method to test for content properties. Enhanced script People API - added method to test for admin authority. Changed User Dashboard default template to two column. Removed some old files/folders no longer needed in slingshot. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9942 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/java/org/alfresco/repo/jscript/People.java | 13 +++++++++++++ .../java/org/alfresco/repo/jscript/ScriptNode.java | 12 ++++++++++++ .../org/alfresco/repo/template/BaseContentNode.java | 12 ++++++++++++ 3 files changed, 37 insertions(+) diff --git a/source/java/org/alfresco/repo/jscript/People.java b/source/java/org/alfresco/repo/jscript/People.java index 5bd686b8ea..cc074c6e4b 100644 --- a/source/java/org/alfresco/repo/jscript/People.java +++ b/source/java/org/alfresco/repo/jscript/People.java @@ -441,6 +441,19 @@ public final class People extends BaseScopableProcessorExtension } return Context.getCurrentContext().newArray(getScope(), parents); } + + /** + * Return true if the specified user is an Administrator authority. + * + * @param person to test + * + * @return true if an admin, false otherwise + */ + public boolean isAdmin(ScriptNode person) + { + ParameterCheck.mandatory("Person", person); + return this.authorityService.isAdminAuthority((String)person.getProperties().get(ContentModel.PROP_USERNAME)); + } /** * Get Contained Authorities diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java index 1e98e18920..967f6e542e 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java @@ -2434,6 +2434,18 @@ public class ScriptNode implements Serializable, Scopeable return result != null ? result : new Object[0]; } + /** + * Helper to return true if the supplied property value is a ScriptContentData object + * + * @param o Object to test + * + * @return true if instanceof ScriptContentData, false otherwise + */ + public boolean isScriptContent(Object o) + { + return (o instanceof ScriptContentData); + } + // ------------------------------------------------------------------------------ // Value Conversion diff --git a/source/java/org/alfresco/repo/template/BaseContentNode.java b/source/java/org/alfresco/repo/template/BaseContentNode.java index 57fd3286c9..5b70c83159 100644 --- a/source/java/org/alfresco/repo/template/BaseContentNode.java +++ b/source/java/org/alfresco/repo/template/BaseContentNode.java @@ -471,6 +471,18 @@ public abstract class BaseContentNode implements TemplateContent return (content != null ? content.getSize() : 0L); } + /** + * Helper to return true if the supplied property value is a TemplateContentData object + * + * @param o Object to test + * + * @return true if instanceof TemplateContentData, false otherwise + */ + public boolean isTemplateContent(Object o) + { + return (o instanceof TemplateContentData); + } + // ------------------------------------------------------------------------------ // Inner classes