//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Summary description for WeblogPermissions.
	/// </summary>
	public class WeblogPermissions
	{
		private WeblogPermissions()
		{
		}

        /// <summary>
        /// Returns a list of WeblogPermissions for the selected Weblog
        /// </summary>
        /// <param name="weblogId"></param>
        /// <returns></returns>
        public static ArrayList GetBlogPermissions(int weblogId)
        {
            WeblogDataProvider wdp = WeblogDataProvider.Instance();
            return wdp.GetBlogPermissions(weblogId);
        }

        /// <summary>
        /// Returns the WeblogPermission that matches the weblogId and RoleId
        /// </summary>
        public static WeblogPermission GetBlogPermission(int weblogId, Guid roleId)
        {
            ArrayList list = GetBlogPermissions(weblogId);
            foreach(WeblogPermission bp in list)
            {
                if(bp.RoleID == roleId)
                    return bp;
            }
            return null;
        }
	}
}
