using IronIntel.Contractor;
using IronIntel.Contractor.Site.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Security_Security : SecurityBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!CheckLoginSession())
        {
            RedirectToLoginPage();
        }
        else
        {
            string methodName = Request.Form["MethodName"];
            if (!string.IsNullOrEmpty(methodName))
            {
                ProcessRequest(methodName);
            }
            else if (!IsPostBack)
            {
                this.Title = PageTitle;
            }
        }
    }

    protected override bool AllowCurrentLoginSessionEnter()
    {
        var f = base.AllowCurrentLoginSessionEnter();
        if (!f)
        {
            return false;
        }

        var user = GetCurrentUser();
        return user != null && user.UserType >= IronIntel.Contractor.Users.UserTypes.Admin;
    }

    protected override int FeatureID
    {
        get
        {
            return Foresight.Fleet.Services.User.Feature.USERS;
        }
    }
}