当前位置: 首页>>代码示例>>C#>>正文


C# Permissions.HasPermission方法代码示例

本文整理汇总了C#中Permissions.HasPermission方法的典型用法代码示例。如果您正苦于以下问题:C# Permissions.HasPermission方法的具体用法?C# Permissions.HasPermission怎么用?C# Permissions.HasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permissions的用法示例。


在下文中一共展示了Permissions.HasPermission方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnInit

        protected override void OnInit( EventArgs e )
        {
            base.OnInit( e );

              #region Security check
              currentLoggedInUserPermissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();
              if ( currentLoggedInUserPermissions == null || !currentLoggedInUserPermissions.HasPermission( StoreSpecificPermissionType.AccessSettings, store.Id ) ) {
            throw new SecurityException();
              }
              #endregion

              AddTab( CommonTerms.Common, PnCommon, SaveButton_Clicked );
              AddTab( StoreTerms.Order, PnOrder, SaveButton_Clicked );
              AddTab( StoreTerms.Product, PnProduct, SaveButton_Clicked );
              AddTab( CommonTerms.GiftCards, PnGiftCard, SaveButton_Clicked );
              AddTab( "UI", PnTemplateRendering, SaveButton_Clicked );

              PPnlName.Text = CommonTerms.Name;
              PPnlDefaultCountry.Text = StoreTerms.DefaultCountry;
              PPnlDefaultVatGroup.Text = StoreTerms.DefaultVatGroup;
              PPnlDefaultOrderStatus.Text = StoreTerms.DefaultOrderStatus;
              PPnlConfirmationEmail.Text = StoreTerms.ConfirmationEmailTemplate;
              PPnlPaymentInconsistencyEmail.Text = StoreTerms.PaymentInconsistencyEmailTemplate;
              PPnlPricesIsSpecifiedWithVat.Text = StoreTerms.PricesIsSpecifiedWithVat;
              PPnlChkPersistOrderId.Text = StoreTerms.UseCookies;
              PPnlChkOrderPersistanceTimeout.Text = StoreTerms.CookieTimeout + "<br /><small>" + StoreTerms.CookieTimeoutHelp + "</small>";

              PPnlCartNumberPrefix.Text = StoreTerms.CartNumberPrefix;
              PPnlOrderNumberPrefix.Text = StoreTerms.OrderNumberPrefix;

              PPnlProductPropertyAliases.Text = StoreTerms.ProductPropertyAliases;
              PPnlProductUniquenessPropertyAliases.Text = StoreTerms.ProductUniquenessPropertyAliases;
              PPnlStockSharingStore.Text = StoreTerms.StockSharingStore + "<br /><small>" + StoreTerms.StockSharingStoreHelp + "</small>";

              PPnlGiftCardLength.Text = StoreTerms.Length;
              PPnlGiftCardDaysValid.Text = StoreTerms.DaysValid;
              PPnlGiftCardPrefix.Text = StoreTerms.Prefix;
              PPnlGiftCardSuffix.Text = StoreTerms.Suffix;

              PPnlEditOrderUIFile.Text = StoreTerms.EditOrderUiFile;
              PPnlTemplateRendering.Text = StoreTerms.AllowedTemplateFilesForRendering + "<br /><small>" + StoreTerms.AllowedTemplateFilesForRenderingHelp + "</small>";
        }
开发者ID:uniquelau,项目名称:Tea-Commerce-for-Umbraco,代码行数:42,代码来源:EditStore.aspx.cs

示例2: OnInit

        protected override void OnInit( EventArgs e )
        {
            base.OnInit( e );

              umbraco.BusinessLogic.User currentUser = umbraco.helper.GetCurrentUmbracoUser();

              #region Security check
              currentUserPermissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();
              if ( currentUserPermissions == null || !currentUserPermissions.HasPermission( GeneralPermissionType.AccessSecurity ) ) {
            throw new SecurityException();
              } else {
            bool showUser = true;

            umbraco.BusinessLogic.User user = umbraco.BusinessLogic.User.GetUser( int.Parse( HttpContext.Current.Request.QueryString[ "id" ] ) );
            showUser = !user.IsRoot(); //Don't ever show admin user

            if ( showUser ) {
              bool showAllUsers = currentUser.IsRoot() || currentUser.Applications.Any( a => a.alias == "users" );
              showUser = showAllUsers || currentUser.Id == user.Id || ( permissions != null && currentUserPermissions.StoreSpecificPermissions.Any( p => p.Value.HasFlag( StoreSpecificPermissionType.AccessStore ) && permissions.HasPermission( StoreSpecificPermissionType.AccessStore, p.Key ) ) );
            }

            if ( !showUser ) {
              throw new SecurityException();
            }
              }
              #endregion

              AddTab( CommonTerms.Common, PnlCommon, SaveButton_Clicked );

              PPnlAccessSecurity.Text = StoreTerms.Security;
              ImgAccessSecurity.ImageUrl = WebUtils.GetWebResourceUrl( Constants.TreeIcons.Lock );
              PPnlAccessLicenses.Text = DeveloperTerms.Licenses;
              ImgAccessLicenses.ImageUrl = WebUtils.GetWebResourceUrl( Constants.TreeIcons.LicenseKey );
              PPnlCreateAndDeleteStore.Text = CommonTerms.CreateAndDeleteStore;
              ImgCreateAndDeleteStore.ImageUrl = WebUtils.GetWebResourceUrl( Constants.TreeIcons.Store );

              PnStoreSpecificPermissions.Text = CommonTerms.Stores;
              PPnlStoreSpecificPermissions.Text = CommonTerms.StoreSpecificPermissions;
        }
开发者ID:uniquelau,项目名称:Tea-Commerce-for-Umbraco,代码行数:39,代码来源:EditUserPermissions.aspx.cs


注:本文中的Permissions.HasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。