mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
64469: Merged WAT1 (4.3/Cloud) to HEAD-BUG-FIX (4.3/Cloud) 63596: ACE-809: Updated site-admin webscript to include the new attribute "userIsSiteManager". git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64615 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -80,8 +80,9 @@ public class SiteAdminSitesGet extends DeclarativeWebScript
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
// check the current user access rights
|
||||
if (!siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser()))
|
||||
if (!siteService.isSiteAdmin(currentUser))
|
||||
{
|
||||
// Note: security, no message to indicate why
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Resource no found.");
|
||||
@@ -113,8 +114,8 @@ public class SiteAdminSitesGet extends DeclarativeWebScript
|
||||
for (SiteInfo info : result)
|
||||
{
|
||||
sites.add(SiteState.create(info,
|
||||
siteService.listMembers(info.getShortName(), null, SiteModel.SITE_MANAGER, 0), nodeService,
|
||||
personService));
|
||||
siteService.listMembers(info.getShortName(), null, SiteModel.SITE_MANAGER, 0), currentUser,
|
||||
nodeService, personService));
|
||||
}
|
||||
|
||||
Map<String, Object> sitesData = new HashMap<String, Object>(6);
|
||||
|
@@ -40,19 +40,21 @@ public class SiteState
|
||||
|
||||
private SiteInfo siteInfo;
|
||||
private List<MemberState> members;
|
||||
private boolean currentUserSiteManager;
|
||||
|
||||
private SiteState()
|
||||
{
|
||||
}
|
||||
|
||||
public static SiteState create(SiteInfo siteInfo, Map<String, String> members, NodeService nodeService,
|
||||
PersonService personService)
|
||||
public static SiteState create(SiteInfo siteInfo, Map<String, String> members, String currentUser,
|
||||
NodeService nodeService, PersonService personService)
|
||||
{
|
||||
SiteState result = new SiteState();
|
||||
result.members = new ArrayList<MemberState>(members.size());
|
||||
|
||||
result.siteInfo = siteInfo;
|
||||
|
||||
boolean found = false;
|
||||
Set<String> siteMembers = members.keySet();
|
||||
for (String userName : siteMembers)
|
||||
{
|
||||
@@ -63,6 +65,12 @@ public class SiteState
|
||||
String lastName = (String) nodeService.getProperty(person, ContentModel.PROP_LASTNAME);
|
||||
result.members.add(new MemberState(userName, firstName, lastName));
|
||||
}
|
||||
|
||||
if (!found && userName.equals(currentUser))
|
||||
{
|
||||
found = true;
|
||||
result.currentUserSiteManager = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -78,6 +86,11 @@ public class SiteState
|
||||
return this.members;
|
||||
}
|
||||
|
||||
public boolean isCurrentUserSiteManager()
|
||||
{
|
||||
return this.currentUserSiteManager;
|
||||
}
|
||||
|
||||
public static class MemberState
|
||||
{
|
||||
private String userName;
|
||||
|
Reference in New Issue
Block a user