Display posts creation form on groups pages.

This commit is contained in:
Pierre HUBERT
2018-07-16 09:13:51 +02:00
parent 07af7c961d
commit 5c0cdced85
4 changed files with 46 additions and 4 deletions

View File

@ -23,6 +23,26 @@ ComunicWeb.components.groups.utils = {
return IDs;
}
},
/**
* Check whether a user can create posts for a group or not
*
* @param {Object} info Information about the target group
* @return {boolean} TRUE if the user can create a post / FALSE else
*/
canCreatePosts: function(info){
//Administrator and moderators can always create posts
if(info.membership == "administrator" || info.membership == "moderator")
return true;
if(info.membership == "member" && info.posts_level == "members")
return true;
//In all the other case, the user can not create posts
return false;
},
}