【发布时间】:2020-07-21 09:35:18
【问题描述】:
是否可以根据访问限制来限制对视图某些部分的访问?目前我可以通过在控制器中执行此操作来限制用户访问页面
[RestrictAccess(restriction = AccessRestrictions.Admin)]
但我是否可以限制页面的某个方面,同时仍允许其他用户访问该页面?
这是检查用户是否具有访问权限的模型
public enum AccessRestrictions
{
[Display(Name = "Admin")]
Admin
}
public class userAccess
{
[Key]
public int ID { get; set; }
public AccessRestrictions restriction { get; set; }
public bool allow { get; set; }
public int userID { get; set; }
}
public class configDetails
{
public int ID {get; set;}
public string Name {get; set;}
public string Value {get;set;}
public bool deleted {get;set;}
public DateTime updateTime { get; set; }
}
public class Config
{
public int ID { get; set; }
[Display(Name = "Configuration Date")]
public DateTime TargetDate { get; set; }
[Display(Name = "Enable Access Restrictions")]
public bool restrictAccess { get; set; }
}
【问题讨论】:
标签: javascript c# html css asp.net-mvc