Пример #1
0
 public string ToPrettyString()
 {
     return("BasicAccountPermissionsSet {" +
            $"\n{nameof(AccountAllowed)}: {AccountAllowed.GetFlags().Select(f => f.GetApiRepresentation()).ToPrettyString()}, " +
            $"\n{nameof(AccountDenied)}: {AccountDenied.GetFlags().Select(f => f.GetApiRepresentation()).ToPrettyString()}" +
            "\n}");
 }
Пример #2
0
        internal IEnumerable <(string, string)> GetAsParams()
        {
            IEnumerable <(string, string)> allowed = GeneralAllowed.GetFlags()
                                                     .Select(f => f.GetApiRepresentation())
                                                     .Concat(AccountAllowed.GetFlags()
                                                             .Select(f => f.GetApiRepresentation()))
                                                     .Select(a => (($"permissions[{a}][explicit]", "1"),
                                                                   ($"permissions[{a}][enabled]", "1")))
                                                     .Interleave();
            IEnumerable <(string, string)> denied = GeneralDenied.GetFlags()
                                                    .Select(f => f.GetApiRepresentation())
                                                    .Concat(AccountDenied.GetFlags()
                                                            .Select(f => f.GetApiRepresentation()))
                                                    .Select(a => (($"permissions[{a}][explicit]", "1"),
                                                                  ($"permissions[{a}][enabled]", "0")))
                                                    .Interleave();

            IEnumerable <(string, string)> locked = GeneralLocked.GetFlags()
                                                    .Select(f => f.GetApiRepresentation())
                                                    .Concat(AccountLocked.GetFlags()
                                                            .Select(f => f.GetApiRepresentation()))
                                                    .Select(a => ($"permissions[{a}][locked]", "1"));

            return(allowed.Concat(denied).Concat(locked));
        }