/// <summary> /// Get the permissions set of an account. /// </summary> /// <param name="checkedPermissions">The permissions to test.</param> /// <param name="accountId">(Optional; default = self) The account id.</param> /// <returns>The account permissions set.</returns> public async Task <BasicAccountPermissionsSet> GetAccountPermissions(AccountRolePermissions checkedPermissions, ulong?accountId = null) { var args = checkedPermissions.GetFlagsApiRepresentations().Select(p => ("permissions[]", p)); var response = await _client.GetAsync($"accounts/{accountId.IdOrSelf()}/permissions" + BuildDuplicateKeyQueryString(args.ToArray())); var dictionary = JsonConvert.DeserializeObject <Dictionary <string, bool> >(await response.Content.ReadAsStringAsync()); AccountRolePermissions allowed = default,
public RolePermissionsSet(GeneralRolePermissions generalAllowed = default, GeneralRolePermissions generalDenied = default, AccountRolePermissions accountAllowed = default, AccountRolePermissions accountDenied = default, GeneralRolePermissions generalLocked = default, AccountRolePermissions accountLocked = default) { GeneralAllowed = generalAllowed; GeneralDenied = generalDenied; AccountAllowed = accountAllowed; AccountDenied = accountDenied; GeneralLocked = generalLocked; AccountLocked = accountLocked; }
internal static IEnumerable <string> GetRepresentations(this AccountRolePermissions e) { return(e.GetFlags() .Select(f => f.GetApiRepresentation())); }
public BasicAccountPermissionsSet(AccountRolePermissions accountAllowed, AccountRolePermissions accountDenied) { AccountAllowed = accountAllowed; AccountDenied = accountDenied; }