58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using CloudBuilder.Core.DependencyInjection.Policy;
|
|
using CloudBuilder.Core.DependencyInjection.Request;
|
|
using CloudBuilder.Core.Policy;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CloudBuilder.Security.Policy
|
|
{
|
|
public class SecurityUserTypePolicy : LocalePolicy, IPolicy
|
|
{
|
|
public const string NORMAL_USERS = "N";
|
|
public const string ICTI_USERS = "I";
|
|
public const string SEDEX_USERS = "S";
|
|
public const string KOHLS_USERS = "K";
|
|
|
|
private readonly IContext context;
|
|
private readonly ILocaleMessageManager localeMessageManager;
|
|
|
|
public SecurityUserTypePolicy(IContext context, ILocaleMessageManager localeMessageManager) : base(context, localeMessageManager)
|
|
{
|
|
this.context = context;
|
|
this.localeMessageManager = localeMessageManager;
|
|
|
|
this.Name = typeof(SecurityUserTypePolicy).Name;
|
|
}
|
|
|
|
|
|
public static bool IsNormalUser(string code)
|
|
{
|
|
return code == NORMAL_USERS;
|
|
}
|
|
|
|
public static bool IsIctiUser(string code)
|
|
{
|
|
return code == ICTI_USERS;
|
|
}
|
|
|
|
public static bool IsSedexUser(string code)
|
|
{
|
|
return code == SEDEX_USERS;
|
|
}
|
|
|
|
public static bool IsKohlsUser(string code)
|
|
{
|
|
return code == KOHLS_USERS;
|
|
}
|
|
|
|
|
|
public static bool IsAuditor(string code)
|
|
{
|
|
return IsIctiUser(code) || IsSedexUser(code) || IsKohlsUser(code);
|
|
}
|
|
}
|
|
}
|