示例#1
0
        public IAuthenticationClient Create(AuthorizationType client)
        {
            var name   = client.ToString();
            var result = _service.GetServiceByName <IAuthenticationClient>(name);

            return(result);
        }
示例#2
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            UserPermissionCache cache = (UserPermissionCache)(Session["cache"]);

            System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <string, string> > attrs;
            AuthorizationType a = cache.CheckAccess("Operation0", DateTime.Now, out attrs);

            this.TextBox1.Text = a.ToString();
        }
示例#3
0
        public void Save(long userId, string userName, string secret, AuthorizationType authorizationType, OrganizationLink organization)
        {
            var props = new Dictionary <string, string>();

            props.Add("UserName", userName);
            props.Add("Secret", secret);
            props.Add("AuthorizationType", authorizationType.ToString());
            props.Add("Organization", organization.ToJsonOrEmptyString());
            props.Add("AvatarUrl", userId.ToString().AsAvatarUrl(organization.HostName));

            _accountStore.Save(new Account(userId.ToString(), props), _applicationSettings.AppName);
        }
示例#4
0
 /// <summary>
 /// 设置授权类型
 /// </summary>
 /// <param name="descriptor">服务描述符。</param>
 /// <param name="authType">授权类型</param>
 /// <returns>服务描述符。</returns>
 public static ServiceDescriptor AuthType(this ServiceDescriptor descriptor, AuthorizationType authType)
 {
     descriptor.Metadatas["AuthType"] = authType.ToString();
     return(descriptor);
 }
        public IAuthorizationService GetAuthorizationService(AuthorizationType type)
        {
            var service = _provider.GetServiceByName <IAuthorizationService>(type.ToString());

            return(service);
        }
示例#6
0
        /// <summary>
        /// Write the response status to the stream.
        /// </summary>
        /// <param name="writeEndOfHeaders">Write the end of the header bytes, carrige return line feed.</param>
        /// <param name="writeResponseStatus">Write the response status (HTTP/1.1 200 OK)</param>
        public virtual void WriteWebResponseHeaders(bool writeEndOfHeaders = true, bool writeResponseStatus = true)
        {
            byte[] buffer = null;
            string data   = "";

            // If chunked is used.
            if (SendChunked)
            {
                AddHeader("Transfer-Encoding", "Chunked");
            }

            // If the server has been specified.
            if (!String.IsNullOrEmpty(Server))
            {
                AddHeader("Server", Server);
            }

            // If content length has been specified.
            if (ContentLength > 0)
            {
                AddHeader("Content-Length", ContentLength.ToString());
            }

            // If the allow has been specified.
            if (!String.IsNullOrEmpty(Allow))
            {
                AddHeader("Allow", Allow);
            }

            // If the content type has been specified.
            if (!String.IsNullOrEmpty(ContentType))
            {
                AddHeader("Content-Type", ContentType);
            }

            // If the Upgrade has been specified.
            if (!String.IsNullOrEmpty(Upgrade))
            {
                // If an upgrade is required
                // then set the connection to upgrade
                // and set the upgrade to the protocol (e.g. WebSocket, HTTP/2.0 .. etc).
                AddHeader("Connection", "Upgrade");
                AddHeader("Upgrade", Upgrade);
            }
            else
            {
                // If the connection is open.
                if (KeepAlive)
                {
                    AddHeader("Connection", "Keep-Alive");
                }
            }

            // If the content encoding has been specified.
            if (!String.IsNullOrEmpty(ContentEncoding))
            {
                AddHeader("Content-Encoding", ContentEncoding);
            }

            // If the content lanaguage has been specified.
            if (!String.IsNullOrEmpty(ContentLanguage))
            {
                AddHeader("Content-Language", ContentLanguage);
            }

            // If authenticate type is other than none.
            if (AuthorizationType != Nequeo.Security.AuthenticationType.None)
            {
                AddHeader("WWW-Authenticate", AuthorizationType.ToString());
            }

            // Write response status.
            if (writeResponseStatus)
            {
                // If protocol version http/2 is used.
                if ((ProtocolVersion.ToLower().Equals("http/2")) || (ProtocolVersion.ToLower().Equals("http/2.0")))
                {
                    // Send the http response status.
                    data   = ":status = " + StatusCode.ToString() + (StatusSubcode > 0 ? "." + StatusSubcode.ToString() : "") + _deli;
                    buffer = Encoding.Default.GetBytes(data);
                    Write(buffer, 0, buffer.Length);
                }
                else
                {
                    // Send the http response status.
                    data   = ProtocolVersion + " " + StatusCode.ToString() + (StatusSubcode > 0 ? "." + StatusSubcode.ToString() : "") + " " + StatusDescription + _deli;
                    buffer = Encoding.Default.GetBytes(data);
                    Write(buffer, 0, buffer.Length);
                }
            }

            // If headers exists.
            if (Headers != null)
            {
                // For each header found.
                foreach (string header in Headers.AllKeys)
                {
                    // If protocol version http/2 is used.
                    if ((ProtocolVersion.ToLower().Equals("http/2")) || (ProtocolVersion.ToLower().Equals("http/2.0")))
                    {
                        // Add each header.
                        data   = header.ToLower() + " = " + Headers[header] + _deli;
                        buffer = Encoding.Default.GetBytes(data);
                        Write(buffer, 0, buffer.Length);
                    }
                    else
                    {
                        // Add each header.
                        data   = header + ": " + Headers[header] + _deli;
                        buffer = Encoding.Default.GetBytes(data);
                        Write(buffer, 0, buffer.Length);
                    }
                }
            }

            // If cookies exists.
            if (Cookies != null)
            {
                // For each cookie found.
                foreach (Cookie cookie in Cookies)
                {
                    // Make shore the cookie has been set.
                    if (!String.IsNullOrEmpty(cookie.Name) && !String.IsNullOrEmpty(cookie.Value))
                    {
                        // Get the cookie details.
                        data = "Set-Cookie" + ": " + cookie.Name + "=" + cookie.Value +
                               (cookie.Expires != null ? "; Expires=" + cookie.Expires.ToUniversalTime().ToLongDateString() + " " + cookie.Expires.ToUniversalTime().ToLongTimeString() + " GMT" : "") +
                               (!String.IsNullOrEmpty(cookie.Path) ? "; Path=" + cookie.Path : "") +
                               (!String.IsNullOrEmpty(cookie.Domain) ? "; Domain=" + cookie.Domain : "") +
                               (cookie.Version > 0 ? "; Version=" + cookie.Version : "") +
                               (cookie.Secure ? "; Secure" : "") +
                               (cookie.HttpOnly ? "; HttpOnly" : "") +
                               _deli;

                        // Write to the stream.
                        buffer = Encoding.Default.GetBytes(data);
                        Write(buffer, 0, buffer.Length);
                    }
                }
            }

            // Write the end of the headers.
            if (writeEndOfHeaders)
            {
                // Send the header end space.
                data   = _deli;
                buffer = Encoding.Default.GetBytes(data);
                Write(buffer, 0, buffer.Length);
            }
        }
示例#7
0
        private void CreateRow(string roleOrUser, AuthorizationType type, IEnumerable<string> allowedOperations)
        {
            int index = tblPermissions.Rows.Count;
            Icon icon = (type == AuthorizationType.Role) ? Icon.Group : Icon.User;
            GenericIdentity identity = new GenericIdentity((type == AuthorizationType.User) ? roleOrUser : string.Empty);
            string[] roles = (type == AuthorizationType.Role) ? new[] { roleOrUser } : new string[] { };
            IPrincipal user = new GenericPrincipal(identity, roles);
            TableRow row = new TableRow();
            TableCell imageCell = new TableCell();
            imageCell.Controls.Add(new LiteralControl("<img src=\"" + Utility.GetCooliteIconUrl(icon) + "\" />"));
            imageCell.Controls.Add(new HiddenField { ID = "hdn" + index + "Type", Value = type.ToString() });
            imageCell.Controls.Add(new HiddenField { ID = "hdn" + index + "RoleOrUser", Value = roleOrUser });
            row.Cells.Add(imageCell);
            row.Cells.Add(new TableCell { Text = roleOrUser });
            foreach (string operation in allowedOperations)
            {
                CheckBox checkBox = new CheckBox
                {
                    ID = "chk" + index + operation,
                    Checked = Engine.SecurityManager.IsAuthorized(SelectedItem, user, operation)
                };
                TableCell cell = new TableCell { CssClass = "operation" };
                cell.Controls.Add(checkBox);
                row.Cells.Add(cell);
            }

            TableCell deleteCell = new TableCell();
            LinkButton deleteButton = new LinkButton { ID = "btnDelete" + index, Text = "Delete" };
            deleteButton.Click += deleteButton_Click;
            deleteCell.Controls.Add(deleteButton);
            row.Cells.Add(deleteCell);

            tblPermissions.Rows.Add(row);

            switch (type)
            {
                case AuthorizationType.Role:
                    _displayedRoles.Add(roleOrUser);
                    break;
                case AuthorizationType.User:
                    _displayedUsers.Add(roleOrUser);
                    break;
            }
        }
示例#8
0
        public CommunicatorConfiguration(IDictionary <string, string> properties)
        {
            if (properties != null)
            {
                ApiEndpoint       = GetApiEndpoint(properties);
                AuthorizationType = AuthorizationType.GetValueOf(GetProperty(properties, "onlinePayments.api.authorizationType", AuthorizationType.ToString()));
                ConnectTimeout    = GetTimeout(properties, "onlinePayments.api.connectTimeout", ConnectTimeout);
                SocketTimeout     = GetTimeout(properties, "onlinePayments.api.socketTimeout", SocketTimeout);
                MaxConnections    = GetProperty(properties, "onlinePayments.api.maxConnections", MaxConnections);

                var proxyURI = GetProperty(properties, "onlinePayments.api.proxy.uri");
                if (proxyURI != null)
                {
                    ProxyConfiguration.Uri      = new Uri(proxyURI);
                    ProxyConfiguration.Username = GetProperty(properties, "onlinePayments.api.proxy.username");
                    ProxyConfiguration.Password = GetProperty(properties, "onlinePayments.api.proxy.password");
                }

                Integrator = GetProperty(properties, "onlinePayments.api.integrator", "");
            }
        }
        private bool PrintItem(PrintPageEventArgs e, IAzManItem item, int indentLevel, float parentItemX, float parentItemY)
        {
            Icon itemIcon = null;

            switch (item.ItemType)
            {
            case ItemType.Role:
                itemIcon = Properties.Resources.Role_16x16;
                break;

            case ItemType.Task:
                itemIcon = Properties.Resources.Task_16x16;
                break;

            case ItemType.Operation:
                itemIcon = Properties.Resources.Operation_16x16;
                break;
            }
            float parentParentItemX = 0.0F;
            float parentParentItemY = 0.0F;

            if (!this.alreadyPrinted.Contains(item.ItemId))
            {
                base.WriteLineString(new String('\t', indentLevel), itemIcon, String.Format("{0}{1}", item.Name, (String.IsNullOrEmpty(item.Description) ? String.Empty : String.Format(" - {0}", item.Description))), e);
                if (parentItemX == 0 || parentItemY == 0)
                {
                    parentItemX = e.Graphics.MeasureString(new String('\t', indentLevel - 1), base.font).Width + itemIcon.Size.Width / 2;
                    parentItemY = base.lastY - 1.5F;
                }
                parentParentItemX = base.lastX + itemIcon.Width / 2;
                parentParentItemY = base.lastY + itemIcon.Height + 3;
                this.alreadyPrinted.Add(item.ItemId);
                if (base.EOP)
                {
                    return(true);
                }
            }
            AuthorizationType authType = AuthorizationType.AllowWithDelegation;

            while (true)
            {
                IAzManAuthorization[] authz = new IAzManAuthorization[item.Authorizations.Count];
                string sAuthz    = String.Empty;
                Image  imageType = null;
                item.Authorizations.CopyTo(authz, 0);;
                if (authz.Length > 0)
                {
                    if (!this.alreadyPrinted.Contains(item.ItemId.ToString() + authType.ToString()))
                    {
                        string sAuthType = String.Empty;
                        switch (authType)
                        {
                        case AuthorizationType.AllowWithDelegation: sAuthType = Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegation"); imageType = Properties.Resources.AllowForDelegation; break;

                        case AuthorizationType.Allow: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Allow"); imageType = Properties.Resources.Allow; break;

                        case AuthorizationType.Deny: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Deny"); imageType = Properties.Resources.Deny; break;

                        case AuthorizationType.Neutral: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Neutral"); imageType = Properties.Resources.Neutral; break;
                        }
                        foreach (IAzManAuthorization auth in authz)
                        {
                            if (auth.AuthorizationType == authType)
                            {
                                string     displayName = String.Empty;
                                MemberType mt          = auth.GetMemberInfo(out displayName);
                                sAuthz += displayName + ", ";
                            }
                        }
                        if (sAuthz.EndsWith(", "))
                        {
                            sAuthz = sAuthz.Remove(sAuthz.Length - 2);
                        }
                        if (!String.IsNullOrEmpty(sAuthz))
                        {
                            base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel + 1), base.font).Width;
                            RectangleF   rect = new RectangleF(this.currentX, this.currentY, e.PageBounds.Width - this.currentX - e.PageBounds.Left, e.PageBounds.Height - e.PageBounds.Top);
                            StringFormat sf   = new StringFormat();
                            sf.FormatFlags = StringFormatFlags.NoClip;
                            sf.Trimming    = StringTrimming.Word;
                            if (this.currentY + this.meauseMultiLines(sAuthz, this.font, rect, sf, e) + this.spaceBetweenLines > e.PageBounds.Bottom - 70)
                            {
                                //all authz in the next page
                                return(true);
                            }
                            base.WriteLineString(new string('\t', indentLevel + 1), imageType, sAuthType.ToUpper(), e);
                            base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel + 1), base.font).Width;
                            base.WriteLineString(sAuthz, e);
                            this.alreadyPrinted.Add(item.ItemId.ToString() + authType.ToString());
                            if (base.EOP)
                            {
                                return(true);
                            }
                            base.WriteLineString(" ", e);
                            if (base.EOP)
                            {
                                return(true);
                            }
                        }
                    }
                }
                bool stop = false;
                switch (authType)
                {
                case AuthorizationType.AllowWithDelegation: authType = AuthorizationType.Allow; break;

                case AuthorizationType.Allow: authType = AuthorizationType.Deny; break;

                case AuthorizationType.Deny: authType = AuthorizationType.Neutral; break;

                case AuthorizationType.Neutral: stop = true; break;
                }
                if (stop)
                {
                    break;
                }
            }
            return(false);
        }
示例#10
0
        /// <summary>
        /// Write the request to the stream.
        /// </summary>
        /// <param name="writeEndOfHeaders">Write the end of the header bytes, carrige return line feed.</param>
        public virtual void WriteNetRequestHeaders(bool writeEndOfHeaders = true)
        {
            byte[] buffer = null;
            string data   = "";

            // If content length has been specified.
            if (ContentLength > 0)
            {
                AddHeader("Content-Length", ContentLength.ToString());
            }

            // If the Host been specified.
            if (!String.IsNullOrEmpty(Host))
            {
                AddHeader("Host", Host);
            }

            // If the content type has been specified.
            if (!String.IsNullOrEmpty(ContentType))
            {
                AddHeader("Content-Type", ContentType);
            }

            // If the content encoding has been specified.
            if (AcceptEncoding != null)
            {
                AddHeader("Accept-Encoding", String.Join(",", AcceptEncoding));
            }

            // If the content lanaguage has been specified.
            if (AcceptLanguages != null)
            {
                AddHeader("Accept-Language", String.Join(",", AcceptLanguages));
            }

            // If the content accept types has been specified.
            if (AcceptTypes != null)
            {
                AddHeader("Accept", String.Join(",", AcceptTypes));
            }

            // If the UrlReferrer has been specified.
            if (UrlReferrer != null)
            {
                AddHeader("Referer", UrlReferrer.OriginalString);
            }

            // If the upgrade has been specified.
            if (!String.IsNullOrEmpty(Upgrade))
            {
                // If an upgrade is required
                // then set the connection to upgrade
                // and set the upgrade to the protocol (e.g. WebSocket, HTTP/2.0 .. etc).
                AddHeader("Connection", "Upgrade");
                AddHeader("Upgrade", Upgrade);
            }
            else
            {
                // If the connection is open.
                if (KeepAlive)
                {
                    AddHeader("Connection", "Keep-Alive");
                }
            }

            // If the credentials has been specified.
            if (Credentials != null)
            {
                string userAndPassword  = Credentials.UserName + ":" + Credentials.Password;
                byte[] credentialBytes  = Encoding.Default.GetBytes(userAndPassword);
                string credentialString = Convert.ToBase64String(credentialBytes);
                AddHeader("Authorization", AuthorizationType.ToString() + " " + credentialString);
            }

            // If cookies exist.
            if (Cookies != null)
            {
                string cookieNameValueCol = "";

                // For each cookie found.
                foreach (Cookie cookie in Cookies)
                {
                    // Make shore the cookie has been set.
                    if (!String.IsNullOrEmpty(cookie.Name) && !String.IsNullOrEmpty(cookie.Value))
                    {
                        // Set the name value cookie collection.
                        cookieNameValueCol += cookie.Name + "=" + cookie.Value + ";";
                    }
                }

                // Only set the cookies if a name value exists.
                if (!String.IsNullOrEmpty(cookieNameValueCol))
                {
                    // Add the cookie header.
                    AddHeader("Cookie", cookieNameValueCol.TrimEnd(';'));
                }
            }

            // If protocol version http/2 is used.
            if ((ProtocolVersion.ToLower().Equals("http/2")) || (ProtocolVersion.ToLower().Equals("http/2.0")))
            {
                // Send the http request.
                data   = ":method = " + Method + _deli + ":scheme = " + Scheme + _deli + ":path = " + Path + _deli;
                buffer = Encoding.Default.GetBytes(data);
                Write(buffer, 0, buffer.Length);
            }
            else
            {
                // Send the http request.
                data   = Method + " " + Path + " " + ProtocolVersion + _deli;
                buffer = Encoding.Default.GetBytes(data);
                Write(buffer, 0, buffer.Length);
            }

            // If headers exists.
            if (Headers != null)
            {
                // For each header found.
                foreach (string header in Headers.AllKeys)
                {
                    // If protocol version http/2 is used.
                    if ((ProtocolVersion.ToLower().Equals("http/2")) || (ProtocolVersion.ToLower().Equals("http/2.0")))
                    {
                        // Add each header.
                        data   = header.ToLower() + " = " + Headers[header] + _deli;
                        buffer = Encoding.Default.GetBytes(data);
                        Write(buffer, 0, buffer.Length);
                    }
                    else
                    {
                        // Add each header.
                        data   = header + ": " + Headers[header] + _deli;
                        buffer = Encoding.Default.GetBytes(data);
                        Write(buffer, 0, buffer.Length);
                    }
                }
            }

            // Write the end of the headers.
            if (writeEndOfHeaders)
            {
                // Send the header end space.
                data   = _deli;
                buffer = Encoding.Default.GetBytes(data);
                Write(buffer, 0, buffer.Length);
            }
        }
        private bool PrintItem(PrintPageEventArgs e, IAzManItem item, int indentLevel, float parentItemX, float parentItemY)
        {
            Icon itemIcon = null;

            switch (item.ItemType)
            {
            case ItemType.Role:
                itemIcon = Properties.Resources.Role_16x16;
                break;

            case ItemType.Task:
                itemIcon = Properties.Resources.Task_16x16;
                break;

            case ItemType.Operation:
                itemIcon = Properties.Resources.Operation_16x16;
                break;
            }
            float parentParentItemX = 0.0F;
            float parentParentItemY = 0.0F;

            if (!this.alreadyPrinted.Contains(item.ItemId))
            {
                base.WriteLineString(new String('\t', indentLevel), itemIcon, String.Format("{0}{1}", item.Name, (String.IsNullOrEmpty(item.Description) ? String.Empty : String.Format(" - {0}", item.Description))), e);
                if (parentItemX == 0 || parentItemY == 0)
                {
                    parentItemX = e.Graphics.MeasureString(new String('\t', indentLevel - 1), base.font).Width + itemIcon.Size.Width / 2;
                    parentItemY = base.lastY - 1.5F;
                }
                parentParentItemX = base.lastX + itemIcon.Width / 2;
                parentParentItemY = base.lastY + itemIcon.Height + 3;
                this.alreadyPrinted.Add(item.ItemId);
                if (base.EOP)
                {
                    return(true);
                }
            }

            //Effective Permissions
            AuthorizationType authType = AuthorizationType.AllowWithDelegation;

            while (true)
            {
                if (!this.alreadyPrinted.Contains(item.ItemId.ToString() + authType.ToString()))
                {
                    Image  imageType = null;
                    string sAuthz    = String.Empty;
                    string sAuthType = String.Empty;
                    switch (authType)
                    {
                    case AuthorizationType.AllowWithDelegation: sAuthType = Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegation"); imageType = Properties.Resources.AllowForDelegation; break;

                    case AuthorizationType.Allow: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Allow"); imageType = Properties.Resources.Allow; break;

                    case AuthorizationType.Deny: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Deny"); imageType = Properties.Resources.Deny; break;
                        //case AuthorizationType.Neutral: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Neutral"); imageType = Properties.Resources.Neutral; break;
                    }
                    if (this.userIdenities == null)
                    {
                        this.userIdenities = new List <WindowsIdentity>();
                        foreach (string userUpn in this.userUPNs)
                        {
                            try
                            {
                                WindowsIdentity winId = new WindowsIdentity(userUpn);
                                this.userIdenities.Add(winId);
                            }
                            catch
                            {
                                //Invalid user (expired, locked, disabled, etc...)
                                //Do not add
                            }
                        }
                    }
                    if (this.dbUserIdentities == null)
                    {
                        this.dbUserIdentities = new List <IAzManDBUser>(item.Application.Store.Storage.GetDBUsers());
                    }
                    //Windows Users
                    foreach (WindowsIdentity wid in this.userIdenities)
                    {
                        try
                        {
                            AuthorizationType effectiveAuthorization =
                                this.storageCache.CheckAccess(item.Application.Store.Name, item.Application.Name,
                                                              item.Name, wid.GetUserBinarySSid(), wid.GetGroupsBinarySSid(),
                                                              DateTime.Now, false);
                            if (effectiveAuthorization == authType)
                            {
                                sAuthz += wid.Name + ", ";
                            }
                        }
                        catch
                        {
                            //Do nothing
                        }
                    }
                    //DB Users
                    foreach (IAzManDBUser did in this.dbUserIdentities)
                    {
                        try
                        {
                            AuthorizationType effectiveAuthorization =
                                this.storageCache.CheckAccess(item.Application.Store.Name, item.Application.Name,
                                                              item.Name, did.CustomSid.StringValue,
                                                              DateTime.Now, false);
                            if (effectiveAuthorization == authType)
                            {
                                sAuthz += did.UserName + ", ";
                            }
                        }
                        catch
                        {
                            //Do nothing
                        }
                    }
                    if (sAuthz.EndsWith(", "))
                    {
                        sAuthz = sAuthz.Remove(sAuthz.Length - 2);
                    }
                    if (!String.IsNullOrEmpty(sAuthz))
                    {
                        base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel + 1), base.font).Width;
                        RectangleF   rect = new RectangleF(this.currentX, this.currentY, e.PageBounds.Width - this.currentX - e.PageBounds.Left, e.PageBounds.Height - e.PageBounds.Top);
                        StringFormat sf   = new StringFormat();
                        sf.FormatFlags = StringFormatFlags.NoClip;
                        sf.Trimming    = StringTrimming.Word;
                        if (this.currentY + this.meauseMultiLines(sAuthz, this.font, rect, sf, e) + this.spaceBetweenLines > e.PageBounds.Bottom - 70)
                        {
                            //all authz in the next page
                            return(true);
                        }
                        base.WriteLineString(new string('\t', indentLevel + 1), imageType, sAuthType.ToUpper(), e);
                        base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel + 1), base.font).Width;
                        base.WriteLineString(sAuthz, e);
                        this.alreadyPrinted.Add(item.ItemId.ToString() + authType.ToString());
                        if (base.EOP)
                        {
                            return(true);
                        }
                        base.WriteLineString(" ", e);
                        if (base.EOP)
                        {
                            return(true);
                        }
                    }
                }
                bool stop = false;
                switch (authType)
                {
                case AuthorizationType.AllowWithDelegation: authType = AuthorizationType.Allow; break;

                case AuthorizationType.Allow: authType = AuthorizationType.Deny; break;

                case AuthorizationType.Deny: authType = AuthorizationType.Neutral; stop = true; break;
                    //case AuthorizationType.Neutral: stop = true; break;
                }
                if (stop)
                {
                    break;
                }

                //OLD
                //IAzManAuthorization[] authz = new IAzManAuthorization[item.Authorizations.Count];
                //string sAuthz = String.Empty;
                //Image imageType = null;
                //item.Authorizations.CopyTo(authz, 0); ;
                //if (authz.Length > 0)
                //{
                //    if (!this.alreadyPrinted.Contains(item.ItemId.ToString() + authType.ToString()))
                //    {
                //        string sAuthType = String.Empty;
                //        switch (authType)
                //        {
                //            case AuthorizationType.AllowWithDelegation: sAuthType = Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegation"); imageType = Properties.Resources.AllowForDelegation; break;
                //            case AuthorizationType.Allow: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Allow"); imageType = Properties.Resources.Allow; break;
                //            case AuthorizationType.Deny: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Deny"); imageType = Properties.Resources.Deny; break;
                //            case AuthorizationType.Neutral: sAuthType = Globalization.MultilanguageResource.GetString("Domain_Neutral"); imageType = Properties.Resources.Neutral; break;
                //        }
                //        foreach (IAzManAuthorization auth in authz)
                //        {
                //            if (auth.AuthorizationType == authType)
                //            {
                //                string displayName = String.Empty;
                //                MemberType mt = auth.GetMemberInfo(out displayName);
                //                sAuthz += displayName + ", ";
                //            }
                //        }
                //        if (sAuthz.EndsWith(", ")) sAuthz = sAuthz.Remove(sAuthz.Length - 2);
                //        if (!String.IsNullOrEmpty(sAuthz))
                //        {
                //            base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel+1), base.font).Width;
                //            RectangleF rect = new RectangleF(this.currentX, this.currentY, e.PageBounds.Width - this.currentX - e.PageBounds.Left, e.PageBounds.Height - e.PageBounds.Top);
                //            StringFormat sf = new StringFormat();
                //            sf.FormatFlags = StringFormatFlags.NoClip;
                //            sf.Trimming = StringTrimming.Word;
                //            if (this.currentY + this.meauseMultiLines(sAuthz, this.font, rect, sf, e) + this.spaceBetweenLines > e.PageBounds.Bottom - 70)
                //            {
                //                //all authz in the next page
                //                return true;
                //            }
                //            base.WriteLineString(new string('\t', indentLevel + 1), imageType, sAuthType.ToUpper(), e);
                //            base.currentX = e.Graphics.MeasureString(new string('\t', indentLevel + 1), base.font).Width;
                //            base.WriteLineString(sAuthz, e);
                //            this.alreadyPrinted.Add(item.ItemId.ToString() + authType.ToString());
                //            if (base.EOP) return true;
                //            base.WriteLineString(" ", e);
                //            if (base.EOP) return true;
                //        }
                //    }
                //}
                //bool stop = false;
                //switch (authType)
                //{
                //    case AuthorizationType.AllowWithDelegation: authType = AuthorizationType.Allow; break;
                //    case AuthorizationType.Allow: authType = AuthorizationType.Deny; break;
                //    case AuthorizationType.Deny: authType = AuthorizationType.Neutral; break;
                //    case AuthorizationType.Neutral: stop = true; break;
                //}
                //if (stop) break;
            }
            return(false);
        }