MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Privacy setting and multi-user Blogs  (Mono Support )

Viewed 30807 time(s), 12 post(s) 8/3/2011 1:47:42 PMby Vijay
Vijay

Vijay

9/27/2011 4:51:27 AM
Hi Khorvat for the help,

As I am new in MonoX and still understanding the architecture and code, It would be helpful if you send me stepwise tasks which in need to do to set permissions in Blogs and Discussion Forums.

Regards
Vijay
This content has not been rated yet. 
43 Reputation 5 Total posts
khorvat

khorvat

9/27/2011 3:10:32 PM
Hi,

below I'll show you some of the steps you need to perform, but some of the steps you will need to your self.

Copy BlogContainer.ascx to your folder (We will use it to reference all your custom Blog controls)

1. Create a page and add the BlogContainer WebPart 
...
<%@ Register TagPrefix="MonoX" TagName="BlogContainer" Src="/YourProjectName/ModuleGallery/Blog/BlogContainer.ascx" %>
...
<MonoX:BlogContainer ID="blogContainer" runat="server" UsePrettyPhoto="true" DateFormatString="d" RelatedContentVisible="false" EnableSyntaxHighlighter="true" GravatarRenderType="NotSet" />
...

2. Now you need to check for the permissions

- You can check if user is a member of specific group by running this code
...
var groupBLL = MonoSoftware.MonoX.BusinessLayer.GroupBLL.GetInstance();
groupBLL.GroupId = Some group that you want to use (you can fetch the group id with the MonoSoftware.MonoX.Repositories.GroupRepository)
var status = groupBLL.GetStatus(Guid userId) //you can use SecurityUtility.GetUserId() to get the current user id
blogContainer.Visible = (status.Equals(GroupMemberStatus.ApprovedMember) || status.Equals(GroupMemberStatus.Admin));
...

- or you can check if you are friend with the current user
...
var friendRepository = MonoSoftware.MonoX.Repositories.FriendRepository.GetInstance();
blogContainer.Visible = friendRepository.FriendRequestExists(yourId, SecurityUtility.GetUserId());
...

And as for comments you need to inherit from BlogPostView.ascx and to do so please follow these steps
1. Copy the BlogPostView.ascx (only ascx file) to your folder
2. Add code-behind file (cs) named BlogPostView.ascx.cs and redirect it like this
From
<%@ Control Language="C#" AutoEventWireup="true" Inherits="MonoSoftware.MonoX.ModuleGallery.Blog.BlogPostView" Codebehind="BlogPostView.ascx.cs" %>
To
<%@ Control Language="C#" AutoEventWireup="true" Inherits="YourNameSpace.BlogPostView" Codebehind="BlogPostView.ascx.cs" %>
3. In the Page_PreRender you need to add functionality similar to the Blog permissions described above but here you will show/hide ctlComments
4. Now you need to reference your BlogPostView in the BlogContainer
From
<%@ Register TagPrefix="MonoX" TagName="BlogPostView" Src="/MonoX/ModuleGallery/Blog/BlogPostView.ascx" %>
To
<%@ Register TagPrefix="MonoX" TagName="BlogPostView" Src="/YourProjectName/ModuleGallery/Blog/BlogPostView.ascx" %>

Now everything should be prepared for test run.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
1 2