public string GetPermissionDependencies()
        {
            var sb = new StringBuilder();

            // add the names of the existing permissiontypes
            for (int x = 0; x < PermissionType.PermissionCount; x++)
            {
                sb.Append("//");
                for (int i = 0; i < x; i++)
                {
                    sb.Append("|  ");
                }
                sb.AppendLine(PermissionType.GetByIndex(x).Name);
            }

            // add the list of depending permissions
            for (int y = 0; y < PermissionType.PermissionCount; y++)
            {
                sb.Append("            ");
                sb.Append(y == 0 ? "[[" : " [");
                sb.Append(String.Join(", ", SecurityHandler.PermissionDependencyTable[y]));
                sb.Append("], //").AppendLine(PermissionType.GetByIndex(y).Name);
            }
            sb.Append("            ]");
            return(sb.ToString());
        }
Exemplo n.º 2
0
        public static IEnumerable <PermissionType> GetPermissionTypesByMask(string maskValue)
        {
            var result = new List <PermissionType>();
            var length = maskValue.Length;

            for (int i = maskValue.Length - 1; i >= 0; i--)
            {
                if (maskValue[i] != '_')
                {
                    result.Add(PermissionType.GetByIndex(length - i - 1));
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public static IEnumerable <PermissionType> MigrateOldValues(IEnumerable <int> intValues)
        {
            var result = intValues.Select(i => PermissionType.GetByIndex(_migrationTable[i])).ToArray();

            return(result);
        }