本文整理汇总了C#中IPermission类的典型用法代码示例。如果您正苦于以下问题:C# IPermission类的具体用法?C# IPermission怎么用?C# IPermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPermission类属于命名空间,在下文中一共展示了IPermission类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreatePermissionElement
internal static SecurityElement CreatePermissionElement(IPermission perm, string permname)
{
SecurityElement element = new SecurityElement("IPermission");
XMLUtil.AddClassAttribute(element, perm.GetType(), permname);
element.AddAttribute("version", "1");
return element;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:CodeAccessPermission.cs
示例2: FrameDescHelper
[System.Security.SecurityCritical] // auto-generated
private static bool FrameDescHelper(FrameSecurityDescriptor secDesc,
IPermission demandIn,
PermissionToken permToken,
RuntimeMethodHandleInternal rmh)
{
return secDesc.CheckDemand((CodeAccessPermission) demandIn, permToken, rmh);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:SecurityRuntime.cs
示例3: RoleUserController
public RoleUserController(IRoleUser repoRoleUser
, IRole repoRole, IPermission repoPer)
{
dalRoleUser = repoRoleUser;
dalRole = repoRole;
dalPermission = repoPer;
}
开发者ID:mmxftp,项目名称:JSMiracle.AutoWarehouse,代码行数:7,代码来源:RoleUserController.cs
示例4: IsSubsetOf
public override bool IsSubsetOf(IPermission target)
{
bool flag;
if (target == null)
{
return !this.unrestricted;
}
try
{
DistributedTransactionPermission permission = (DistributedTransactionPermission) target;
if (!this.unrestricted)
{
return true;
}
if (permission.unrestricted)
{
return true;
}
flag = false;
}
catch (InvalidCastException)
{
throw new ArgumentException(System.Transactions.SR.GetString("ArgumentWrongType"), "target");
}
return flag;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:DistributedTransactionPermission.cs
示例5: TestBase
public TestBase()
{
var builder = new ContainerBuilder();
builder.RegisterType<DatabaseFactory>().As<IDatabaseFactory>().InstancePerLifetimeScope();
builder.RegisterType<UnityOfWork>().As<IUnitOfWork>();
builder.RegisterType<ContactRepostory>().AsImplementedInterfaces();
builder.RegisterType<ContactServices>().AsImplementedInterfaces();
builder.RegisterType<ProductRepository>().AsImplementedInterfaces();
builder.RegisterType<LodgingRepository>().AsImplementedInterfaces();
builder.RegisterType<ResortRepository>().AsImplementedInterfaces();
builder.RegisterType<ProductService>().AsImplementedInterfaces();
builder.RegisterType<LodgingService>().AsImplementedInterfaces();
builder.RegisterType<ResortService>().AsImplementedInterfaces();
#region 权限
builder.RegisterType<PermissionModuleRepository>().AsImplementedInterfaces();
builder.RegisterType<PermissionRoleRepository>().AsImplementedInterfaces();
builder.RegisterType<PermissionReRoleModuleRepostory>().AsImplementedInterfaces();
builder.RegisterType<PermissionSvc>().AsImplementedInterfaces();
#endregion
container= builder.Build();
this.unitOfWork = container.Resolve<IUnitOfWork>();
this.contact=container.Resolve<IContact>();
this.productsvc=container.Resolve<IProduct>();
this.resortSvc = container.Resolve<IResort>();
this.lodgingsvc = container.Resolve<ILodging>();
this.permissionSvc = container.Resolve<IPermission>();
// StartUp();
}
开发者ID:Jan307,项目名称:permissionrepository,代码行数:31,代码来源:TestBase.cs
示例6: IsGranted
// Determine if a specific permission has been granted.
public static bool IsGranted(IPermission perm)
{
// Bail out if the requested permission is null.
if(perm == null)
{
return true;
}
// Get the current permission state.
ClrPermissions current = ClrSecurity.GetPermissionsFrom(1);
if(current == null)
{
// Null is equivalent to "unrestricted".
return true;
}
// Build a permission set with just this permission.
PermissionSet set = new PermissionSet(PermissionState.None);
set.AddPermission(perm);
// If "PermitOnly" is set, then only check that set.
if(current.permitOnly != null)
{
return set.IsSubsetOf(current.permitOnly);
}
// The permission must be granted, but not denied.
if(!set.IsSubsetOf(current.granted) ||
set.IsSubsetOf(current.denied))
{
return false;
}
return true;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:35,代码来源:SecurityManager.cs
示例7: Intersect
public override IPermission Intersect(IPermission target)
{
if (target == null)
{
return null;
}
if (!base.VerifyType(target))
{
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
}
SecurityPermission permission = (SecurityPermission) target;
SecurityPermissionFlag noFlags = SecurityPermissionFlag.NoFlags;
if (permission.IsUnrestricted())
{
if (this.IsUnrestricted())
{
return new SecurityPermission(PermissionState.Unrestricted);
}
noFlags = this.m_flags;
}
else if (this.IsUnrestricted())
{
noFlags = permission.m_flags;
}
else
{
noFlags = this.m_flags & permission.m_flags;
}
if (noFlags == SecurityPermissionFlag.NoFlags)
{
return null;
}
return new SecurityPermission(noFlags);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:SecurityPermission.cs
示例8: Intersect
public override IPermission Intersect(IPermission target)
{
if (target == null)
return null;
return this.Copy();
}
开发者ID:jplu,项目名称:virtuoso-opensource,代码行数:7,代码来源:VirtuosoCodeAccessPermission.cs
示例9: Union
//------------------------------------------------------
//
// IPERMISSION IMPLEMENTATION
//
//------------------------------------------------------
public override IPermission Union(IPermission target)
{
if (target == null)
{
return this.Copy();
}
else if (!VerifyType(target))
{
throw new
ArgumentException(
Environment.GetResourceString("Argument_WrongType", this.GetType().FullName)
);
}
IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target;
if (this.IsUnrestricted() || operand.IsUnrestricted())
{
return new IsolatedStorageFilePermission( PermissionState.Unrestricted );
}
else
{
IsolatedStorageFilePermission union;
union = new IsolatedStorageFilePermission( PermissionState.None );
union.m_userQuota = max(m_userQuota,operand.m_userQuota);
union.m_machineQuota = max(m_machineQuota,operand.m_machineQuota);
union.m_expirationDays = max(m_expirationDays,operand.m_expirationDays);
union.m_permanentData = m_permanentData || operand.m_permanentData;
union.m_allowed = (IsolatedStorageContainment)max((long)m_allowed,(long)operand.m_allowed);
return union;
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:38,代码来源:isolatedstoragefilepermission.cs
示例10: IsSubsetOf
public override bool IsSubsetOf(IPermission target)
{
bool flag;
if (target == null)
{
return (this.access == FileDialogPermissionAccess.None);
}
try
{
FileDialogPermission permission = (FileDialogPermission) target;
if (permission.IsUnrestricted())
{
return true;
}
if (this.IsUnrestricted())
{
return false;
}
int num = ((int) this.access) & 1;
int num2 = ((int) this.access) & 2;
int num3 = ((int) permission.Access) & 1;
int num4 = ((int) permission.Access) & 2;
flag = (num <= num3) && (num2 <= num4);
}
catch (InvalidCastException)
{
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
}
return flag;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:FileDialogPermission.cs
示例11: IsSubsetOf
public override bool IsSubsetOf(IPermission target)
{
if (target == null)
{
return ((m_userQuota == 0) &&
(m_machineQuota == 0) &&
(m_expirationDays == 0) &&
(m_permanentData == false) &&
(m_allowed == IsolatedStorageContainment.None));
}
try
{
IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target;
if (operand.IsUnrestricted())
return true;
return ((operand.m_userQuota >= m_userQuota) &&
(operand.m_machineQuota >= m_machineQuota) &&
(operand.m_expirationDays >= m_expirationDays) &&
(operand.m_permanentData || !m_permanentData) &&
(operand.m_allowed >= m_allowed));
}
catch (InvalidCastException)
{
throw new
ArgumentException(
Environment.GetResourceString("Argument_WrongType", this.GetType().FullName)
);
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:isolatedstoragefilepermission.cs
示例12: Intersect
public override IPermission Intersect(IPermission target)
{
if (target == null)
{
return null;
}
if (!base.VerifyType(target))
{
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
}
IsolatedStorageFilePermission permission = (IsolatedStorageFilePermission) target;
if (permission.IsUnrestricted())
{
return this.Copy();
}
if (base.IsUnrestricted())
{
return target.Copy();
}
IsolatedStorageFilePermission permission2 = new IsolatedStorageFilePermission(PermissionState.None) {
m_userQuota = IsolatedStoragePermission.min(base.m_userQuota, permission.m_userQuota),
m_machineQuota = IsolatedStoragePermission.min(base.m_machineQuota, permission.m_machineQuota),
m_expirationDays = IsolatedStoragePermission.min(base.m_expirationDays, permission.m_expirationDays),
m_permanentData = base.m_permanentData && permission.m_permanentData,
m_allowed = (IsolatedStorageContainment) ((int) IsolatedStoragePermission.min((long) base.m_allowed, (long) permission.m_allowed))
};
if ((((permission2.m_userQuota == 0L) && (permission2.m_machineQuota == 0L)) && ((permission2.m_expirationDays == 0L) && !permission2.m_permanentData)) && (permission2.m_allowed == IsolatedStorageContainment.None))
{
return null;
}
return permission2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:IsolatedStorageFilePermission.cs
示例13: Intersect
public override IPermission Intersect(IPermission target)
{
//If nothing was passed, return null.
if (null == target)
{
return null;
}
try
{
//Create a new instance of RobocodeInternalPermission from the passed object.
var PassedPermission = (RobocodeInternalPermission) target;
//If one class has an unrestricted value of false, then the
//intersection will have an unrestricted value of false.
//Return the passed class with the unrestricted value of false.
if (!PassedPermission.unrestricted)
{
return target;
}
//Return a copy of the current class if the passed one has
//an unrestricted value of true.
return Copy();
}
//Catch an InvalidCastException.
//Throw ArgumentException to notify the user.
catch (InvalidCastException)
{
throw new ArgumentException("Argument_WrongType", GetType().FullName);
}
}
开发者ID:hgzapata,项目名称:robocode,代码行数:30,代码来源:RobocodeInternalPermission.cs
示例14: GetTokenIndex
// IBuiltInPermission is internal but we can test it's values
// using reflection.
private int GetTokenIndex (IPermission p)
{
Type t = p.GetType ();
int result = (int) t.InvokeMember ("System.Security.Permissions.IBuiltInPermission.GetTokenIndex",
BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance,
null, p, null);
return result;
}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:IBuiltInPermissionTest.cs
示例15: Intersect
public override IPermission Intersect(IPermission target)
{
if (target == null)
return null;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return this.Copy();
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:GACIdentityPermission.cs
示例16: IsSubsetOf
public override bool IsSubsetOf(IPermission target)
{
if (target == null)
return false;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return true;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:GACIdentityPermission.cs
示例17: IsSubsetOf
public override bool IsSubsetOf (IPermission target)
{
DnsPermission dp = Cast (target);
if (dp == null)
return IsEmpty ();
return (dp.IsUnrestricted () || (m_noRestriction == dp.m_noRestriction));
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:DnsPermission.cs
示例18: Union
public override IPermission Union(IPermission target)
{
if ((target != null) && !(target is GacIdentityPermission))
{
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[] { base.GetType().FullName }));
}
return this.Copy();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:GacIdentityPermission.cs
示例19: IsSubsetOf
public override bool IsSubsetOf (IPermission target)
{
ZoneIdentityPermission zip = Cast (target);
if (zip == null)
return (zone == SecurityZone.NoZone);
return ((zone == SecurityZone.NoZone) || (zone == zip.zone));
}
开发者ID:jack-pappas,项目名称:mono,代码行数:8,代码来源:ZoneIdentityPermission.cs
示例20: AddObjectPermission
public void AddObjectPermission(IPermission permission)
{
if (_objectPermissions == null)
{
_objectPermissions = new HashSet<IPermission>();
}
_objectPermissions.Add(permission);
}
开发者ID:katasource,项目名称:shironet,代码行数:8,代码来源:SimpleAuthorizationInfo.cs
注:本文中的IPermission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论