本文整理汇总了Java中org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX属性的典型用法代码示例。如果您正苦于以下问题:Java PermissionService.GROUP_PREFIX属性的具体用法?Java PermissionService.GROUP_PREFIX怎么用?Java PermissionService.GROUP_PREFIX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.alfresco.service.cmr.security.PermissionService
的用法示例。
在下文中一共展示了PermissionService.GROUP_PREFIX属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyInternal
@Override
protected String applyInternal() throws Exception
{
StringBuilder result = new StringBuilder(I18NUtil.getMessage(MSG_START));
String groupAuthorityName = PermissionService.GROUP_PREFIX + this.groupAuthorityDetails.groupName;
if (!authorityService.authorityExists(groupAuthorityName))
{
groupAuthorityName = authorityService.createAuthority(AuthorityType.GROUP,
this.groupAuthorityDetails.groupName,
this.groupAuthorityDetails.groupDisplayName,
this.groupAuthorityDetails.authorityZones);
authorityService.addAuthority(groupAuthorityName, AuthenticationUtil.getAdminUserName());
result.append(I18NUtil.getMessage(MSG_RESULT, groupAuthorityName));
}
else
{
result.append(I18NUtil.getMessage(MSG_EXIST, groupAuthorityName));
}
return result.toString();
}
示例2: testConfigurableSitePublicGroup
/**
* This method tests https://issues.alfresco.com/jira/browse/ALF-3785 which allows 'public' sites
* to be only visible to members of a configured group, by default EVERYONE.
*
* <br><br/>author Neil McErlean
* @since 3.4
*/
@SuppressWarnings("deprecation")
public void testConfigurableSitePublicGroup() throws Exception
{
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
// We'll be configuring a JMX managed bean (in this test method only).
ChildApplicationContextFactory sysAdminSubsystem = (ChildApplicationContextFactory) applicationContext.getBean("sysAdmin");
final String sitePublicGroupPropName = "site.public.group";
final String originalSitePublicGroup = "GROUP_EVERYONE";
try
{
// Firstly we'll ensure that the site.public.group has the correct (pristine) value.
String groupName = sysAdminSubsystem.getProperty(sitePublicGroupPropName);
assertEquals(sitePublicGroupPropName + " was not the pristine value",
originalSitePublicGroup, groupName);
// Create a 'normal', unconfigured site.
SiteInfo unconfiguredSite = siteService.createSite(TEST_SITE_PRESET, "unconfigured",
TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
assertTrue(containsConsumerPermission(originalSitePublicGroup, unconfiguredSite));
// Now set the managed bean's visibility group to something other than GROUP_EVERYONE.
// This is the group that will have visibility of subsequently created sites.
//
// We'll intentionally set it to a group that DOES NOT EXIST YET.
String newGroupName = this.getClass().getSimpleName() + System.currentTimeMillis();
String prefixedNewGroupName = PermissionService.GROUP_PREFIX + newGroupName;
sysAdminSubsystem.stop();
sysAdminSubsystem.setProperty(sitePublicGroupPropName, prefixedNewGroupName);
sysAdminSubsystem.start();
// Now create a site as before. It should fail as we're using a group that doesn't exist.
boolean expectedExceptionThrown = false;
try
{
siteService.createSite(TEST_SITE_PRESET, "thisShouldFail",
TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
}
catch (SiteServiceException expected)
{
expectedExceptionThrown = true;
}
if (!expectedExceptionThrown)
{
fail("Expected exception on createSite with non-existent group was not thrown.");
}
// Now we'll create the group used above.
authorityService.createAuthority(AuthorityType.GROUP, newGroupName);
// And create the site as before. This time it should succeed.
SiteInfo configuredSite = siteService.createSite(TEST_SITE_PRESET, "configured",
TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
// And check the permissions on the site.
assertTrue("The configured site should not have " + originalSitePublicGroup + " as SiteContributor",
!containsConsumerPermission(originalSitePublicGroup, configuredSite));
assertTrue("The configured site should have (newGroupName) as SiteContributor",
containsConsumerPermission(prefixedNewGroupName, configuredSite));
}
finally
{
// Reset the JMX bean to its out-of-the-box values.
sysAdminSubsystem.stop();
sysAdminSubsystem.setProperty(sitePublicGroupPropName, originalSitePublicGroup);
sysAdminSubsystem.start();
}
}