diff --git a/source/java/org/alfresco/repo/security/authority/script/ScriptAuthorityService.java b/source/java/org/alfresco/repo/security/authority/script/ScriptAuthorityService.java index ae8b4297ed..cbeebc6ff3 100644 --- a/source/java/org/alfresco/repo/security/authority/script/ScriptAuthorityService.java +++ b/source/java/org/alfresco/repo/security/authority/script/ScriptAuthorityService.java @@ -88,7 +88,7 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension /** * Get a group given its short name - * @param shortName + * @param shortName, the shortName of the group * @return the authority or null if it can't be found */ public ScriptGroup getGroup(String shortName) @@ -105,9 +105,26 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension return null; } + + /** + * Get a group given it full authority name (Which must begin with 'GROUP_' + * @param fullAuthorityName, the shortName of the group + * @return the authority or null if it can't be found + */ + public ScriptGroup getGroupForFullAuthorityName(String fullAuthorityName) + { + if (authorityService.authorityExists(fullAuthorityName)) + { + ScriptGroup group = new ScriptGroup(fullAuthorityName, authorityService); + return group; + } + // group not found. + return null; + } + /** * Create a new root group - * @return + * @return the new root group. */ public ScriptGroup createRootGroup(String shortName, String displayName) { diff --git a/source/java/org/alfresco/repo/site/SiteServiceImplTest.java b/source/java/org/alfresco/repo/site/SiteServiceImplTest.java index 0a7b7b4061..f31ab61fb0 100644 --- a/source/java/org/alfresco/repo/site/SiteServiceImplTest.java +++ b/source/java/org/alfresco/repo/site/SiteServiceImplTest.java @@ -830,8 +830,6 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest // From sub group four assertEquals(SiteModel.SITE_MANAGER, this.siteService.getMembersRole("testMembership", USER_FOUR)); - - // Remove groups } /** diff --git a/source/java/org/alfresco/service/cmr/site/SiteService.java b/source/java/org/alfresco/service/cmr/site/SiteService.java index b925e1712a..6101a05bbf 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteService.java +++ b/source/java/org/alfresco/service/cmr/site/SiteService.java @@ -124,7 +124,7 @@ public interface SiteService * Gets the role of the specified user. * * @param shortName site short name - * @param authorityName authority name + * @param authorityName full authority name (so if it's a group then its prefixed with 'GROUP_') * @return String site role, null if none */ String getMembersRole(String shortName, String authorityName); @@ -133,7 +133,7 @@ public interface SiteService * Indicates whether an authority is a member of a site or not * * @param shortName site short name - * @param authorityName authority name + * @param authorityName authority name (so if it's a group then its prefixed with 'GROUP_') * @return boolean true if the authority is a member of the site, false otherwise */ boolean isMember(String shortName, String authorityName); @@ -142,7 +142,7 @@ public interface SiteService * Sets the role of an authority within a site * * @param shortName site short name - * @param authorityName authority name + * @param authorityName authority name (so if it's a group then its prefixed with 'GROUP_') * @param role site role */ void setMembership(String shortName, String authorityName, String role); @@ -151,7 +151,7 @@ public interface SiteService * Clears an authorities role within a site * * @param shortName site short name - * @param authorityName authority name + * @param authorityName authority name (so if it's a group then its prefixed with 'GROUP_') */ void removeMembership(String shortName, String authorityName);