예제 #1
0
    protected void MyPartManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e)
    {
        // Ignore authorization in Visual Studio Design Mode
        if (this.DesignMode)
        {
            return;
        }

        // Authorize a web part or not
        Type PartType = e.Type;

        if (PartType == typeof(CustomerNotesPart))
        {
            if (User.Identity.IsAuthenticated)
            {
                if (User.IsInRole("BUILTIN\\Administrators"))
                {
                    e.IsAuthorized = true;
                }
                else
                {
                    e.IsAuthorized = false;
                }
            }
            else
            {
                e.IsAuthorized = false;
            }
        }
    }
예제 #2
0
 protected void wpmManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e)
 {
     // Hide the Unallocated Orders web part if allocation is not enabled
     if (e.Path.EndsWith("wpUnallocatedOrders.ascx", StringComparison.CurrentCultureIgnoreCase))
     {
         e.IsAuthorized = Orchestrator.WebUI.Utilities.IsAllocationEnabled();
     }
 }
예제 #3
0
 protected override void OnAuthorizeWebPart(WebPartAuthorizationEventArgs e)
 {
     if (PEContext.Current.Admin.Identity.IsAuthenticated)
     {
         if (!string.IsNullOrEmpty(e.AuthorizationFilter) && Enum.IsDefined(typeof(OperateCode), e.AuthorizationFilter))
         {
             OperateCode operateCode = (OperateCode)Enum.Parse(typeof(OperateCode), e.AuthorizationFilter);
             if (operateCode == OperateCode.None)
             {
                 e.IsAuthorized = true;
             }
             else
             {
                 e.IsAuthorized = RolePermissions.AccessCheck(operateCode);
             }
         }
     }
     else
     {
         e.IsAuthorized = false;
     }
 }
예제 #4
0
    protected void MyPartManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e)
    {
        // Ignore authorization in Visual Studio Design Mode
        if (this.DesignMode)
            return;

        // Authorize a web part or not
        Type PartType = e.Type;
        if (PartType == typeof(CustomerNotesPart))
        {
            if (User.Identity.IsAuthenticated)
            {
                if (!User.IsInRole("BUILTIN\\Administrators"))
                    e.IsAuthorized = true;
                else
                    e.IsAuthorized = false;
            }
            else
            {
                e.IsAuthorized = false;
            }
        }
    }