/*        private void CheckSuperUser()
        {
            LayoutName = null;
            if ((!(bool)Session["isAdmin"]) && (!(bool)Session["isRoot"]))
                throw new Unauthorized("");
        }
*/

        private void CheckAdmins(Forum forum)
        {
            LayoutName = null;
            if (forum != null)
            {
                User user = (Session.Contains("User")) ? (User) Session["User"] : null;
                if (user != null)
                {
                    bool userbelongstogroup = false;
                    if (((bool)Session["isAdmin"]) || ((bool)Session["isRoot"]))
                        userbelongstogroup = true;
                    foreach (Group g in user.Groups)
                    {
                        if (g.Id == forum.Admins.Id)
                            userbelongstogroup = true;
                    }

                    if (userbelongstogroup == false)
                        throw new Unauthorized();
                }
                else
                    throw new Unauthorized();
            }
            else
                throw new Unauthorized();
        }
        public void CreateForum()
        {
            Commons.CheckSuperUser(Session);

            PropertyBag["groups"] = Group.FindAll();
            PropertyBag["forum"] = new Forum();
            LayoutName = null;
        }