36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using ASPNET.StarterKit.DataAccessLayer;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
namespace ASPNET.StarterKit.BusinessLogicLayer
|
|
{
|
|
public class ControlSecurity
|
|
{
|
|
public List<ControlSecurity> ChildControls { get { return this._Controls; } set { this._Controls = value; } }
|
|
private string _ControlName;
|
|
private int _MinLevel;
|
|
private int _MaxLevel;
|
|
private List<ControlSecurity> _Controls;
|
|
public ControlSecurity(string controlName, int minLevel, int maxLevel, List<ControlSecurity> controls) {
|
|
_ControlName = controlName;
|
|
_MinLevel = minLevel;
|
|
_MaxLevel = maxLevel;
|
|
_Controls = controls;
|
|
}
|
|
public bool CanViewPage(int userLevel)
|
|
{
|
|
if (_MinLevel <= userLevel && _MaxLevel >= userLevel)
|
|
return true;
|
|
return false;
|
|
|
|
}
|
|
public static ControlSecurity GetPageSecurity(string page)
|
|
{
|
|
DataAccess DALLayer = DataAccessHelper.GetDataAccess();
|
|
return (DALLayer.GetPageSecurity(page));
|
|
}
|
|
|
|
|
|
}
|
|
} |