本文整理汇总了C#中Privilege类的典型用法代码示例。如果您正苦于以下问题:C# Privilege类的具体用法?C# Privilege怎么用?C# Privilege使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Privilege类属于命名空间,在下文中一共展示了Privilege类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckPrivilege
public static void CheckPrivilege(Privilege privilege)
{
if (GetCurrentManager() == null)
{
HttpContext.Current.Response.Redirect(Globals.GetAdminAbsolutePath("/accessDenied.aspx?privilege=" + privilege.ToString()));
}
}
开发者ID:ZhangVic,项目名称:asp1110git,代码行数:7,代码来源:ManagerHelper.cs
示例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;
}
开发者ID:nbIxMaN,项目名称:MQTESTS,代码行数:26,代码来源:TestPrivilege.cs
示例3: DbsyncTvPrivilegeType
public DbsyncTvPrivilegeType(Privilege pr)
{
this.priv = pr;
this.Text = pr.Grantee;
this.typeOfIcon = GrantIcon;
this.Name = this.Text;
}
开发者ID:MartinGmc,项目名称:Database-synchronizator,代码行数:7,代码来源:DbsyncTvPrivilegeType.cs
示例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);
}
开发者ID:Rianon,项目名称:mooege,代码行数:7,代码来源:Member.cs
示例5: InternalPrivilegeEnabler
public InternalPrivilegeEnabler(Privilege privilegeName)
{
if (privilegeName == null)
throw new ArgumentNullException("privilegeName");
_mPrivilege = privilegeName;
AdjustPrivilege(true);
}
开发者ID:Sicos1977,项目名称:AlphaFS,代码行数:8,代码来源:InternalPrivilegeEnabler.cs
示例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));
}
开发者ID:Sicos1977,项目名称:AlphaFS,代码行数:14,代码来源:PrivilegeEnabler.cs
示例7: GetGrantPrivilegeQuery
public static string GetGrantPrivilegeQuery(string databaseName, string username, Privilege privilege)
{
return string.Format(
GrantPrivilegeQueryFormat,
privilege.ToString().ToUpper(),
databaseName.FormatIdentifier(),
username.FormatIdentifier()
);
}
开发者ID:scottt732,项目名称:influxdb-csharp,代码行数:9,代码来源:Queries.cs
示例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();
}
开发者ID:cabezotta,项目名称:mooege,代码行数:10,代码来源:Member.cs
示例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;
});
}
开发者ID:damienpuig,项目名称:SafeDriving,代码行数:11,代码来源:RoleService.cs
示例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();
}
开发者ID:loonbg,项目名称:mooege,代码行数:11,代码来源:Member.cs
示例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);
}
开发者ID:davinx,项目名称:himedi,代码行数:12,代码来源:EventLogs.cs
示例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);
}
开发者ID:ZhangVic,项目名称:asp1110git,代码行数:12,代码来源:EventLogs.cs
示例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;
}
开发者ID:alex2015,项目名称:UnitTestApplication,代码行数:14,代码来源:Privileges.cs
示例14: GetInstance
public static Privilege GetInstance()
{
if (_instance == null)
{
lock (_syncRoot)
{
if (_instance == null)
{
_instance = new Privilege();
}
}
}
return _instance;
}
开发者ID:dusdong,项目名称:BaseComponent,代码行数:15,代码来源:Privilege.cs
示例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;
}
}
开发者ID:alex2015,项目名称:UnitTestApplication,代码行数:15,代码来源:PrivilegeEnabler.cs
示例16: CheckPrivilege
public static void CheckPrivilege(Privilege privilege)
{
IUser user = HiContext.Current.User;
if (user.IsAnonymous || (user.UserRole != UserRole.SiteManager))
{
HttpContext.Current.Response.Redirect(Globals.GetAdminAbsolutePath("/accessDenied.aspx?privilege=" + privilege.ToString()));
}
else
{
SiteManager manager = user as SiteManager;
if (!manager.IsAdministrator && !manager.HasPrivilege((int) privilege))
{
HttpContext.Current.Response.Redirect(Globals.GetAdminAbsolutePath("/accessDenied.aspx?privilege=" + privilege.ToString()));
}
}
}
开发者ID:davinx,项目名称:himedi,代码行数:16,代码来源:ManagerHelper.cs
示例17: GetAllFormateur
// Pour la direction
public Resultat<Dictionary<int, string>> GetAllFormateur(Privilege role)
{
return Resultat<Dictionary<int, string>>.SafeExecute<PlanningService>(
result =>
{
int roleId = (int)role;
Dictionary<int, string> dicoFormateurs = new Dictionary<int, string>();
var formateurs = (from c in context.Utilisateurs.OfType<Employe>() where c.RoleId == roleId select c).ToList();
foreach (var c in formateurs)
{
dicoFormateurs.Add(c.Id, c.Nom);
}
result.Valeur = dicoFormateurs;
});
}
开发者ID:damienpuig,项目名称:SafeDriving,代码行数:19,代码来源:PlanningService.cs
示例18: SetSecurityInfo
internal static int SetSecurityInfo(
ResourceType type,
string name,
SafeHandle handle,
SecurityInfos securityInformation,
SecurityIdentifier owner,
SecurityIdentifier group,
GenericAcl sacl,
GenericAcl dacl)
{
int errorCode;
int Length;
byte[] OwnerBinary = null, GroupBinary = null, SaclBinary = null, DaclBinary = null;
Privilege securityPrivilege = null;
//
// Demand unmanaged code permission
// The integrator layer is free to assert this permission
// and, in turn, demand another permission of its caller
//
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
if (owner != null)
{
Length = owner.BinaryLength;
OwnerBinary = new byte[Length];
owner.GetBinaryForm(OwnerBinary, 0);
}
if (@group != null)
{
Length = @group.BinaryLength;
GroupBinary = new byte[Length];
@group.GetBinaryForm(GroupBinary, 0);
}
if (dacl != null)
{
Length = dacl.BinaryLength;
DaclBinary = new byte[Length];
dacl.GetBinaryForm(DaclBinary, 0);
}
if (sacl != null)
{
Length = sacl.BinaryLength;
SaclBinary = new byte[Length];
sacl.GetBinaryForm(SaclBinary, 0);
}
if ((securityInformation & SecurityInfos.SystemAcl) != 0)
{
//
// Enable security privilege if trying to set a SACL.
// Note: even setting it by handle needs this privilege enabled!
//
securityPrivilege = new Privilege(Privilege.Security);
}
// Ensure that the finally block will execute
RuntimeHelpers.PrepareConstrainedRegions();
try
{
if (securityPrivilege != null)
{
try
{
securityPrivilege.Enable();
}
catch (PrivilegeNotHeldException)
{
// we will ignore this exception and press on just in case this is a remote resource
}
}
if (name != null)
{
errorCode = (int)NativeMethods.SetSecurityInfoByName(name, (uint)type, (uint)securityInformation, OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
}
else if (handle != null)
{
if (handle.IsInvalid)
{
throw new ArgumentException("Invalid safe handle");
}
else
{
errorCode = (int)NativeMethods.SetSecurityInfoByHandle(handle, (uint)type, (uint)securityInformation, OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
}
}
else
{
// both are null, shouldn't happen
throw new InvalidProgramException();
}
if (errorCode == NativeMethods.ERROR_NOT_ALL_ASSIGNED ||
//.........这里部分代码省略.........
开发者ID:red-gate,项目名称:LongPath,代码行数:101,代码来源:Common.cs
示例19: EnablePrivilege
internal static AdjustPrivilegeResult EnablePrivilege(AccessTokenHandle accessTokenHandle, Privilege privilege)
{
return AdjustPrivilege(accessTokenHandle, privilege, PrivilegeAttributes.Enabled);
}
开发者ID:alex2015,项目名称:UnitTestApplication,代码行数:4,代码来源:Privileges.cs
示例20: GetLuid
private static Luid GetLuid(Privilege privilege)
{
if (LuidDictionary.ContainsKey(privilege))
{
return LuidDictionary[privilege];
}
Luid luid = new Luid();
if (!NativeMethods.LookupPrivilegeValue(String.Empty, PrivilegeConstantsDictionary[privilege], ref luid))
{
throw new Win32Exception(Marshal.GetLastWin32Error());
}
LuidDictionary.Add(privilege, luid);
return luid;
}
开发者ID:alex2015,项目名称:UnitTestApplication,代码行数:16,代码来源:Privileges.cs
注:本文中的Privilege类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论