ZhiYeJianKang_PeiXun/Song.ViewData/Attri/Purview/PurviewAttribute.cs
2025-02-20 15:41:53 +08:00

52 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Song.ViewData.Attri
{
/// <summary>
/// 权限验证
/// </summary>
public class PurviewAttribute : Attribute
{
private bool _ignore = false;
/// <summary>
/// 忽略此方法,默认为false
/// 说明:则某个类设置了特性后,下面的所有方法都需要验证,除非设置[Admin(Ignore=true)]
/// </summary>
public bool Ignore
{
get { return _ignore; }
set { _ignore = value; }
}
public PurviewAttribute()
{
}
public PurviewAttribute(bool ignore)
{
_ignore = ignore;
}
/// <summary>
/// 是否登录
/// </summary>
/// <returns></returns>
public bool Logged()
{
//return Helper.Admin.Singleton.CurrentUser != null;
return Extend.LoginState.Admin.CurrentUser != null;
}
/// <summary>
/// 将执行结果写入日志
/// </summary>
/// <param name="execResult"></param>
public void LogWrite(object execResult)
{
}
}
}