Skip to content

Commit fa71397

Browse files
committed
Test if user is a site contributor or greater before offering the Create Post action in Site Blog Dashlet
git-svn-id: https://share-extras.googlecode.com/svn/trunk/Site Blog Dashlet@1183 a3f5c567-fd0f-3a89-9b71-a290c5a5f590
1 parent 65abd2f commit fa71397

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

config/alfresco/site-webscripts/org/alfresco/components/dashlets/site-blog.get.html.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010

1111
<div class="dashlet site-blog-posts">
1212
<div class="title">${msg("header.siteBlog")}</div>
13+
<#if userIsSiteContributor>
1314
<div class="toolbar">
1415
<a id="${args.htmlid}-createPost-link" class="theme-color-1" title="${msg('list.createLink')}" href="${url.context}/page/site/${page.url.templateArgs.site}/blog-postedit">${msg("list.createLink")}</a>
1516
</div>
17+
</#if>
1618
<div class="body scrollableList" id="${args.htmlid}-body" <#if args.height??>style="height: ${args.height}px;"</#if>>
1719
</div>
1820
</div>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
function main()
22
{
3+
// Call the repository to see if the user is site manager or not
4+
var userIsSiteContributor = false,
5+
json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" + encodeURIComponent(user.name));
6+
7+
if (json.status == 200)
8+
{
9+
var obj = eval('(' + json + ')');
10+
if (obj)
11+
{
12+
userIsSiteContributor = (obj.role == "SiteContributor" || obj.role == "SiteCollaborator" || obj.role == "SiteManager");
13+
}
14+
}
15+
model.userIsSiteContributor = userIsSiteContributor;
316
}
417

518
main();

0 commit comments

Comments
 (0)