本文整理汇总了Java中org.alfresco.service.cmr.site.SiteInfo.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java SiteInfo.setVisibility方法的具体用法?Java SiteInfo.setVisibility怎么用?Java SiteInfo.setVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.site.SiteInfo
的用法示例。
在下文中一共展示了SiteInfo.setVisibility方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUpdateSite
import org.alfresco.service.cmr.site.SiteInfo; //导入方法依赖的package包/类
public void testUpdateSite()
{
SiteInfo siteInfo = new SiteInfoImpl(TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PRIVATE, null);
// update a site that isn't there
try
{
this.siteService.updateSite(siteInfo);
fail("Shouldn't be able to update a site that does not exist");
}
catch (AlfrescoRuntimeException exception)
{
// Expected
}
// Create a test site
this.siteService.createSite(TEST_SITE_PRESET, "testUpdateSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
// Update the details of the site
this.siteService.updateSite(siteInfo);
siteInfo = this.siteService.getSite("testUpdateSite");
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PRIVATE);
// Update the permission again
siteInfo.setVisibility(SiteVisibility.PUBLIC);
this.siteService.updateSite(siteInfo);
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testUpdateSite", "changedTitle", "changedDescription", SiteVisibility.PUBLIC);
}
示例2: updateSite
import org.alfresco.service.cmr.site.SiteInfo; //导入方法依赖的package包/类
@Override
public Site updateSite(String siteId, SiteUpdate update, Parameters parameters)
{
if (logger.isDebugEnabled())
{
logger.debug("Updating site, ID: "+siteId+", site data: "+update+", parameters: "+parameters);
}
// Get the site by ID (aka short name)
SiteInfo siteInfo = validateSite(siteId);
if (siteInfo == null)
{
// site does not exist
throw new EntityNotFoundException(siteId);
}
// Bind any provided values to the site info, allowing for "partial" updates.
if (update.wasSet(Site.TITLE))
{
siteInfo.setTitle(update.getTitle());
}
if (update.wasSet(Site.DESCRIPTION))
{
siteInfo.setDescription(update.getDescription());
}
if (update.wasSet(Site.VISIBILITY))
{
siteInfo.setVisibility(update.getVisibility());
}
// Validate the new details
validateSite(new Site(siteInfo, null));
// Perform the actual update.
siteService.updateSite(siteInfo);
return getSite(siteId);
}
示例3: testPermissions
import org.alfresco.service.cmr.site.SiteInfo; //导入方法依赖的package包/类
/**
* Tests that the permissions details included with topics and
* posts are correct
*/
public void testPermissions() throws Exception
{
// Create a post, and check the details on it
JSONObject item = createSitePost("test", "test", Status.STATUS_OK);
String name = item.getString("name");
JSONObject perms = item.getJSONObject("permissions");
assertEquals(true, perms.getBoolean("edit"));
assertEquals(true, perms.getBoolean("reply"));
assertEquals(true, perms.getBoolean("delete"));
// Check on a fetch too
item = getPost(name, Status.STATUS_OK);
perms = item.getJSONObject("permissions");
assertEquals(true, perms.getBoolean("edit"));
assertEquals(true, perms.getBoolean("reply"));
assertEquals(true, perms.getBoolean("delete"));
// Switch to another user, see what they see
this.authenticationComponent.setCurrentUser(USER_TWO);
item = getPost(name, Status.STATUS_OK);
perms = item.getJSONObject("permissions");
assertEquals(false, perms.getBoolean("edit"));
assertEquals(true, perms.getBoolean("reply"));
assertEquals(false, perms.getBoolean("delete"));
// Remove the user from the site, see the change
this.siteService.removeMembership(SITE_SHORT_NAME_DISCUSSION, USER_TWO);
item = getPost(name, Status.STATUS_OK);
perms = item.getJSONObject("permissions");
assertEquals(false, perms.getBoolean("edit"));
assertEquals(false, perms.getBoolean("reply"));
assertEquals(false, perms.getBoolean("delete"));
// Make the site private, will vanish
SiteInfo siteInfo = siteService.getSite(SITE_SHORT_NAME_DISCUSSION);
siteInfo.setVisibility(SiteVisibility.PRIVATE);
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
this.siteService.updateSite(siteInfo);
this.authenticationComponent.setCurrentUser(USER_TWO);
// On a private site we're not a member of, shouldn't be visable at all
getPost(name, Status.STATUS_NOT_FOUND);
}
示例4: testChangeSiteVisibility
import org.alfresco.service.cmr.site.SiteInfo; //导入方法依赖的package包/类
/**
* From MNT-14452, insure that GROUP_EVERYONE have read access to public sites' containers.
*/
public void testChangeSiteVisibility()
{
String siteName = GUID.generate();
//Check Private->public
SiteInfo siteInfo = createSite(siteName, "doclib", SiteVisibility.PRIVATE);
NodeRef container = this.siteService.getContainer(siteInfo.getShortName(), "doclib");
siteInfo.setVisibility(SiteVisibility.PUBLIC);
siteService.updateSite(siteInfo);
assertTrue(getAllowedPermissionsMap(container).get(PermissionService.ALL_AUTHORITIES).contains("ReadPermissions"));
//Check public->moderated
siteInfo.setVisibility(SiteVisibility.MODERATED);
siteService.updateSite(siteInfo);
assertNull("GROUP_EVERYONE shouldn't have any permissions on a moderated site's containers", getAllowedPermissionsMap(container).get(PermissionService.ALL_AUTHORITIES));
//Check moderated->public
siteInfo.setVisibility(SiteVisibility.PUBLIC);
siteService.updateSite(siteInfo);
assertTrue(getAllowedPermissionsMap(container).get(PermissionService.ALL_AUTHORITIES).contains("ReadPermissions"));
//Check public->private
siteInfo.setVisibility(SiteVisibility.PRIVATE);
siteService.updateSite(siteInfo);
assertNull("GROUP_EVERYONE shouldn't have any permissions on a moderated site's containers", getAllowedPermissionsMap(container).get(PermissionService.ALL_AUTHORITIES));
}