/// <summary>
        /// Returns rule type for cuttent tenent
        /// </summary>
        /// <returns></returns>
        private PermissionRule.AccessRule GetRuleType()
        {
            var list = (List <AzRecord>)CoreContext.AuthorizationManager.GetAces(Guid.Empty, TcpIpFilterActions.TcpIpFilterAction.ID);

            if (list.Count == 0)
            {
                return(PermissionRule.AccessRule.Deny);
            }

            if (list.FindAll(x => TcpIpFilterSecurityObject.ParseObjectId(x.ObjectId).ToString() != "0.0.0.0").Count > 0)
            {
                return(PermissionRule.AccessRule.Restrictions);
            }

            var internalRules =
                list.FindAll(x => TcpIpFilterSecurityObject.ParseObjectId(x.ObjectId).ToString() == "0.0.0.0");

            foreach (var azRecord in internalRules)
            {
                if (azRecord.Reaction == AceType.Deny)
                {
                    return(PermissionRule.AccessRule.Deny);
                }
            }

            return(PermissionRule.AccessRule.Access);
        }
        /// <summary>
        /// Group users with their ip addresses
        /// </summary>
        /// <param name="list">AzRecord collection</param>
        /// <returns>UserData collectionn</returns>
        private List <UserData> SplitUsers(IEnumerable <AzRecord> list)
        {
            var nList = new List <UserData>();

            foreach (var azRecord in list)
            {
                var ip   = TcpIpFilterSecurityObject.ParseObjectId(azRecord.ObjectId);
                var user = GetUser(nList, azRecord.SubjectId);

                if (user == null)
                {
                    var userInfo = CoreContext.UserManager.GetUsers(azRecord.SubjectId);

                    if (userInfo.ID != ASC.Core.Users.Constants.LostUser.ID)
                    {
                        if (ip.ToString() != "0.0.0.0")
                        {
                            nList.Add(new UserData(userInfo)
                            {
                                IPs = new List <string> {
                                    ip.ToString()
                                },
                                Internal = (ip.ToString() == "0.0.0.0")
                            });
                        }
                    }
                    else
                    {
                        var group = CoreContext.GroupManager.GetGroupInfo(azRecord.SubjectId);
                        nList.Add(new UserData(group.Name, group.ID, ip.ToString() == "0.0.0.0")
                        {
                            IPs = new List <string> {
                                ip.ToString()
                            }
                        });
                    }
                }
                else
                {
                    if (user.Internal)
                    {
                        user.Internal = (ip.ToString() == "0.0.0.0");
                    }
                    if (ip.ToString() != "0.0.0.0")
                    {
                        user.IPs.Add(ip.ToString());
                    }
                }
            }
            return(nList);
        }