public void Test_AccessGranted() { _testHelper.ReplayAll(); bool hasAccess = _securityClient.HasConstructorAccess(typeof(SecurableObject)); _testHelper.VerifyAll(); Assert.That(hasAccess, Is.True); }
public void Test_AccessGranted() { _testHelper.ExpectFunctionalSecurityStrategyHasAccess(GeneralAccessTypes.Create, true); _testHelper.ReplayAll(); bool hasAccess = _securityClient.HasConstructorAccess(typeof(SecurableObject)); _testHelper.VerifyAll(); Assert.That(hasAccess, Is.True); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { GroupTypeList.SetSortingOrder( new BocListSortingOrderEntry((IBocSortableColumnDefinition)GroupTypeList.FixedColumns[0], SortingDirection.Ascending)); } GroupTypeList.LoadUnboundValue(GetValues(), false); SecurityClient securityClient = SecurityClient.CreateSecurityClientFromConfiguration(); NewGroupTypeButton.Visible = securityClient.HasConstructorAccess(typeof(GroupType)); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { TenantList.SetSortingOrder( new BocListSortingOrderEntry((IBocSortableColumnDefinition)TenantList.FixedColumns[0], SortingDirection.Ascending)); } TenantList.LoadUnboundValue(GetValues(), IsPostBack); SecurityClient securityClient = SecurityClient.CreateSecurityClientFromConfiguration(); Type tenantType = SecurityManagerConfiguration.Current.OrganizationalStructureFactory.GetTenantType(); NewTenantButton.Visible = securityClient.HasConstructorAccess(tenantType); }
public bool HasAccess(WxeFunction function) { ArgumentUtility.CheckNotNull("function", function); if (SecurityFreeSection.IsActive) { return(true); } WxeDemandTargetPermissionAttribute attribute = GetPermissionAttribute(function.GetType()); if (attribute == null) { return(true); } WxeDemandMethodPermissionAttributeHelper helper = new WxeDemandMethodPermissionAttributeHelper(function.GetType(), attribute); SecurityClient securityClient = SecurityClient.CreateSecurityClientFromConfiguration(); switch (helper.MethodType) { case MethodType.Instance: return(securityClient.HasMethodAccess(helper.GetSecurableObject(function), helper.MethodName)); case MethodType.Static: return(securityClient.HasStaticMethodAccess(helper.SecurableClass, helper.MethodName)); case MethodType.Constructor: return(securityClient.HasConstructorAccess(helper.SecurableClass)); default: throw new InvalidOperationException(string.Format( "Value '{0}' is not supported by the MethodType property of the WxeDemandMethodPermissionAttribute.", helper.MethodType)); } }