本文整理汇总了C#中Privilege类的典型用法代码示例。如果您正苦于以下问题:C# Privilege类的具体用法?C# Privilege怎么用?C# Privilege使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Privilege类属于命名空间,在下文中一共展示了Privilege类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckPrivilege
public static void CheckPrivilege(Privilege privilege)
{
if (GetCurrentManager() == null)
{
HttpContext.Current.Response.Redirect(Globals.GetAdminAbsolutePath("/accessDenied.aspx?privilege=" + privilege.ToString()));
}
}
示例2: BuildPrivilegeFromDataBaseData
public static List<TestPrivilege> BuildPrivilegeFromDataBaseData(string idPerson)
{
List<TestPrivilege> priveleges = new List<TestPrivilege>();
using (NpgsqlConnection connection = Global.GetSqlConnection())
{
string findPriviledge = "SELECT * FROM public.priviledge WHERE id_person = '" + idPerson + "'";
NpgsqlCommand person = new NpgsqlCommand(findPriviledge, connection);
using (NpgsqlDataReader contactReader = person.ExecuteReader())
{
while (contactReader.Read())
{
//что делать с DateSpecified?
Privilege priv = new Privilege();
if (contactReader["date_start"] != DBNull.Value)
priv.StartDate = Convert.ToDateTime(contactReader["date_start"]);
if (contactReader["date_end"] != DBNull.Value)
priv.EndDate = Convert.ToDateTime(contactReader["date_end"]);
TestPrivilege privilege = new TestPrivilege(priv);
if (contactReader["id_priviledge_code"] != DBNull.Value)
privilege.privilegeType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(contactReader["id_priviledge_code"]));
priveleges.Add(privilege);
}
}
}
return (priveleges.Count != 0) ? priveleges : null;
}
示例3: DbsyncTvPrivilegeType
public DbsyncTvPrivilegeType(Privilege pr)
{
this.priv = pr;
this.Text = pr.Grantee;
this.typeOfIcon = GrantIcon;
this.Name = this.Text;
}
示例4: Member
public Member(bnet.protocol.Identity identity, Privilege privs, params Role[] roles)
{
this.Identity = identity;
this.Privileges = privs;
this.Roles = new List<Role>();
AddRoles(roles);
}
示例5: InternalPrivilegeEnabler
public InternalPrivilegeEnabler(Privilege privilegeName)
{
if (privilegeName == null)
throw new ArgumentNullException("privilegeName");
_mPrivilege = privilegeName;
AdjustPrivilege(true);
}
示例6: PrivilegeEnabler
/// <summary>Initializes a new instance of the <see cref="PrivilegeEnabler"/> class.
/// This will enable the privileges specified (unless already enabled), and ensure that they are disabled again when
/// the object is disposed. (Any privileges already enabled will not be disabled).
/// </summary>
/// <param name="privilege">The privilege to enable.</param>
/// <param name="privileges">Additional privileges to enable.</param>
public PrivilegeEnabler(Privilege privilege, params Privilege[] privileges)
{
_enabledPrivileges.Add(new InternalPrivilegeEnabler(privilege));
if (privileges != null)
foreach (Privilege priv in privileges)
_enabledPrivileges.Add(new InternalPrivilegeEnabler(priv));
}
示例7: GetGrantPrivilegeQuery
public static string GetGrantPrivilegeQuery(string databaseName, string username, Privilege privilege)
{
return string.Format(
GrantPrivilegeQueryFormat,
privilege.ToString().ToUpper(),
databaseName.FormatIdentifier(),
username.FormatIdentifier()
);
}
示例8: Member
public Member(bnet.protocol.Identity identity, Privilege privs)
{
this.Identity = identity;
this.Privileges = privs;
this.Roles = new List<Role>();
this.Info = bnet.protocol.AccountInfo.CreateBuilder()
.SetAccountStatus(bnet.protocol.AccountInfo.Types.AccountStatus.TRIAL)
.SetCountryId(21843)
.Build();
}
示例9: GetRoleByPrivilege
public Resultat<Role> GetRoleByPrivilege(Privilege privilege)
{
return Resultat<Role>.SafeExecute<RoleService>(
result =>
{
int roleId = (int)privilege;
var role = context.Roles.Where(r => r.Id == roleId).First<Role>();
result.Valeur = role;
});
}
示例10: Member
public Member(bnet.protocol.Identity identity, Privilege privs, params Role[] roles)
{
this.Identity = identity;
this.Privileges = privs;
this.Roles = new List<Role>();
AddRoles(roles);
this.Info = bnet.protocol.AccountInfo.CreateBuilder()
.SetAccountPaid(true)
.SetCountryId(21843)
.Build();
}
示例11: WriteOperationLog
public static void WriteOperationLog(Privilege privilege, string description)
{
OperationLogEntry entry2 = new OperationLogEntry();
entry2.AddedTime = DateTime.Now;
entry2.Privilege = privilege;
entry2.Description = description;
entry2.IpAddress = Globals.IPAddress;
entry2.PageUrl = HiContext.Current.Context.Request.RawUrl;
entry2.UserName = HiContext.Current.Context.User.Identity.Name;
OperationLogEntry entry = entry2;
StoreProvider.Instance().WriteOperationLogEntry(entry);
}
示例12: WriteOperationLog
public static void WriteOperationLog(Privilege privilege, string description)
{
OperationLogEntry entry = new OperationLogEntry {
AddedTime = DateTime.Now,
Privilege = privilege,
Description = description,
IpAddress = Globals.IPAddress,
PageUrl = HttpContext.Current.Request.RawUrl,
UserName = ManagerHelper.GetCurrentManager().UserName
};
new LogDao().WriteOperationLogEntry(entry);
}
示例13: GetPrivilegeAttributes
internal static PrivilegeAttributes GetPrivilegeAttributes(Privilege privilege, PrivilegeAndAttributesCollection privileges)
{
foreach (PrivilegeAndAttributes privilegeAndAttributes in privileges)
{
if (privilegeAndAttributes.Privilege == privilege)
{
return privilegeAndAttributes.PrivilegeAttributes;
}
}
GetLuid(privilege);
return PrivilegeAttributes.Removed;
}
示例14: GetInstance
public static Privilege GetInstance()
{
if (_instance == null)
{
lock (_syncRoot)
{
if (_instance == null)
{
_instance = new Privilege();
}
}
}
return _instance;
}
示例15: EnablePrivilege
public AdjustPrivilegeResult EnablePrivilege(Privilege privilege)
{
lock (SharedPrivileges)
{
if (!SharedPrivileges.ContainsKey(privilege) &&
_accessTokenHandle.GetPrivilegeState(privilege) == PrivilegeState.Disabled &&
_accessTokenHandle.EnablePrivilege(privilege) == AdjustPrivilegeResult.PrivilegeModified)
{
SharedPrivileges.Add(privilege, this);
return AdjustPrivilegeResult.PrivilegeModified;
}
return AdjustPrivilegeResult.None;
}
}