mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
- permissions for blog and forum components
- cleanup of taglibrary code git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10400 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<#--
|
||||
This template renders the blog configuration json data.
|
||||
This template renders the blog data object.
|
||||
-->
|
||||
<#macro blogJSON item>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
@@ -13,7 +13,12 @@
|
||||
"description" : "${item.properties["blg:description"]!''}",
|
||||
"url" : "${item.properties["blg:url"]!''}",
|
||||
"username" : "${item.properties["blg:userName"]!''}",
|
||||
"password" : "${item.properties["blg:password"]!''}"
|
||||
"password" : "${item.properties["blg:password"]!''}",
|
||||
"permissions" : {
|
||||
"create" : ${item.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${item.hasPermission("Write")?string},
|
||||
"delete" : ${item.hasPermission("Delete")?string}
|
||||
}
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
@@ -44,7 +44,10 @@
|
||||
</#if>
|
||||
"createdOn" : "${item.createdDate?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
"modifiedOn" : "${item.modifiedDate?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
"permissions" : {"edit" : true, "publishExt" : true, "delete" : true},
|
||||
"permissions" : {
|
||||
"edit" : ${item.node.hasPermission("Write")?string},
|
||||
"delete" : ${item.node.hasPermission("Delete")?string}
|
||||
},
|
||||
"commentCount" : ${item.commentCount?c},
|
||||
"tags" : [<#list item.tags as x>"${x}"<#if x_has_next>, </#if></#list>],
|
||||
|
||||
|
@@ -41,6 +41,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// assign the blog node
|
||||
model.blog = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../blogpost.lib.ftl" as blogpostLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"blogPermissions" : {
|
||||
"create" : ${blog.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${blog.hasPermission("Write")?string},
|
||||
"delete" : ${blog.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@blogpostLib.blogpostJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -42,6 +42,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// assign the blog node
|
||||
model.blog = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../blogpost.lib.ftl" as blogpostLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"blogPermissions" : {
|
||||
"create" : ${blog.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${blog.hasPermission("Write")?string},
|
||||
"delete" : ${blog.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@blogpostLib.blogpostJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
@@ -44,6 +44,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// assign the blog node
|
||||
model.blog = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../blogpost.lib.ftl" as blogpostLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"blogPermissions" : {
|
||||
"create" : ${blog.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${blog.hasPermission("Write")?string},
|
||||
"delete" : ${blog.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@blogpostLib.blogpostJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -40,6 +40,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// assign the blog node
|
||||
model.blog = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../blogpost.lib.ftl" as blogpostLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"blogPermissions" : {
|
||||
"create" : ${blog.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${blog.hasPermission("Write")?string},
|
||||
"delete" : ${blog.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@blogpostLib.blogpostJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -80,6 +80,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// assign the blog node
|
||||
model.blog = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../blogpost.lib.ftl" as blogpostLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"blogPermissions" : {
|
||||
"create" : ${blog.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${blog.hasPermission("Write")?string},
|
||||
"delete" : ${blog.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@blogpostLib.blogpostJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<#import "comment.lib.ftl" as commentLib/>
|
||||
<#import "../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@commentLib.commentJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
@@ -99,6 +99,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// also set the forum node
|
||||
model.forum = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,6 +1,12 @@
|
||||
<#import "../post.lib.ftl" as postLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"forumPermissions" : {
|
||||
"create" : ${forum.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${forum.hasPermission("Write")?string},
|
||||
"delete" : ${forum.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@postLib.postJSON postData=item />
|
||||
</@gen.pagedResults>
|
||||
|
||||
}
|
||||
|
@@ -36,6 +36,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// also set the forum node
|
||||
model.forum = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../post.lib.ftl" as postLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"forumPermissions" : {
|
||||
"create" : ${forum.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${forum.hasPermission("Write")?string},
|
||||
"delete" : ${forum.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@postLib.postJSON postData=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -42,6 +42,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// also set the forum node
|
||||
model.forum = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<#import "../post.lib.ftl" as postLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"forumPermissions" : {
|
||||
"create" : ${forum.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${forum.hasPermission("Write")?string},
|
||||
"delete" : ${forum.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@postLib.postJSON postData=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
@@ -43,6 +43,9 @@ function main()
|
||||
// fetch the contentLength param
|
||||
var contentLength = args["contentLength"] != undefined ? parseInt(args["contentLength"]) : -1;
|
||||
model.contentLength = isNaN(contentLength) ? -1 : contentLength;
|
||||
|
||||
// also set the forum node
|
||||
model.forum = node;
|
||||
}
|
||||
|
||||
main();
|
||||
|
@@ -1,6 +1,12 @@
|
||||
<#import "../post.lib.ftl" as postLib/>
|
||||
<#import "../../generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
"forumPermissions" : {
|
||||
"create" : ${forum.hasPermission("CreateChildren")?string},
|
||||
"edit" : ${forum.hasPermission("Write")?string},
|
||||
"delete" : ${forum.hasPermission("Delete")?string}
|
||||
},
|
||||
<@gen.pagedResults data=data ; item>
|
||||
<@postLib.postJSON postData=item />
|
||||
</@gen.pagedResults>
|
||||
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@
|
||||
"repliesUrl" : "/forum/post/node/${refNode.nodeRef.storeRef.protocol}/${refNode.nodeRef.storeRef.identifier}/${refNode.nodeRef.id}/replies",
|
||||
"nodeRef" : "${refNode.nodeRef}",
|
||||
|
||||
<#-- normal data, the post node will used to fetch it -->
|
||||
<#-- data coming from the post node -->
|
||||
"title" : "${(post.properties.title!"")}",
|
||||
"createdOn" : "${post.properties.created?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
"modifiedOn" : "${post.properties.modified?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
@@ -74,7 +74,12 @@
|
||||
</#if>
|
||||
<@addContent post=post />
|
||||
"replyCount" : <#if post.sourceAssocs["cm:references"]??>${post.sourceAssocs["cm:references"]?size?c}<#else>0</#if>,
|
||||
"permissions" : { "edit": true, "delete" : true, "reply" : true }
|
||||
"permissions" :
|
||||
{
|
||||
"edit": ${post.hasPermission("Write")?string},
|
||||
"reply" : ${post.parent.hasPermission("CreateChildren")?string},
|
||||
"delete" : ${post.hasPermission("Delete")?string}
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
||||
|
@@ -10,14 +10,15 @@
|
||||
|
||||
Usage:
|
||||
<#import "generic-paged-results.lib.ftl" as gen/>
|
||||
{
|
||||
<@gen.pagedResults data=data ; item>
|
||||
output of the individual item, for example by calling another macro:
|
||||
<@yourLib.itemJSON item=item />
|
||||
</@gen.pagedResults>
|
||||
}
|
||||
|
||||
-->
|
||||
<#macro pagedResults data>
|
||||
{
|
||||
"total" : ${data.total?c},
|
||||
"pageSize" : ${data.pageSize?c},
|
||||
"startIndex" : ${data.startIndex?c},
|
||||
@@ -29,5 +30,4 @@ Usage:
|
||||
<#if item_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
||||
</#macro>
|
||||
|
@@ -56,9 +56,9 @@ public class DiscussionServiceTest extends BaseWebScriptTest
|
||||
private SiteService siteService;
|
||||
|
||||
private static final String USER_ADMIN = "admin";
|
||||
private static final String USER_ONE = "UserOneSecond";
|
||||
private static final String USER_TWO = "UserTwoSecond";
|
||||
private static final String SITE_SHORT_NAME_DISCUSSION = "DiscussionSiteShortName";
|
||||
private static final String USER_ONE = "UserOneThird";
|
||||
private static final String USER_TWO = "UserTwoThird";
|
||||
private static final String SITE_SHORT_NAME_DISCUSSION = "DiscussionSiteShortNameTwo";
|
||||
private static final String COMPONENT_DISCUSSION = "discussion";
|
||||
|
||||
private static final String URL_FORUM_POST = "/api/forum/post/site/" + SITE_SHORT_NAME_DISCUSSION + "/" + COMPONENT_DISCUSSION + "/";
|
||||
@@ -79,6 +79,9 @@ public class DiscussionServiceTest extends BaseWebScriptTest
|
||||
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
||||
this.siteService = (SiteService)getServer().getApplicationContext().getBean("siteService");
|
||||
|
||||
// Authenticate as user
|
||||
this.authenticationComponent.setCurrentUser(USER_ADMIN);
|
||||
|
||||
// Create test site
|
||||
// - only create the site if it doesn't already exist
|
||||
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_DISCUSSION);
|
||||
@@ -105,8 +108,10 @@ public class DiscussionServiceTest extends BaseWebScriptTest
|
||||
this.authenticationComponent.setCurrentUser(USER_ADMIN);
|
||||
|
||||
// delete the inviter user
|
||||
personService.deletePerson(USER_ONE);
|
||||
personService.deletePerson(USER_TWO);
|
||||
//personService.deletePerson(USER_ONE);
|
||||
//this.authenticationService.deleteAuthentication(USER_ONE);
|
||||
//personService.deletePerson(USER_TWO);
|
||||
//this.authenticationService.deleteAuthentication(USER_TWO);
|
||||
|
||||
// delete invite site
|
||||
siteService.deleteSite(SITE_SHORT_NAME_DISCUSSION);
|
||||
@@ -134,7 +139,7 @@ public class DiscussionServiceTest extends BaseWebScriptTest
|
||||
}
|
||||
|
||||
// add the user as a member with the given role
|
||||
this.siteService.setMembership(SITE_SHORT_NAME_DISCUSSION, USER_ONE, role);
|
||||
this.siteService.setMembership(SITE_SHORT_NAME_DISCUSSION, userName, role);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user