/// <summary> /// Builds a request from the current state of the workflow run to initiate the appropriate action remotely. /// </summary> /// <param name="context">The workflow run context.</param> /// <param name="inputs">The activity input arguments.</param> /// <returns>The request object.</returns> protected override UserOperationRequest GetRequest(IRunState context, ActivityInputs inputs) { var userName = GetArgumentValue <string>(inputs, UserNameArgumentAlias); var userPassword = GetArgumentValue <string>(inputs, UserPasswordArgumentAlias); var userTenant = GetArgumentValue <string>(inputs, UserTenantArgumentAlias); var userRoles = GetArgumentValue <IEnumerable <IEntity> >(inputs, UserRolesArgumentAlias); var roles = new RoleNames(); if (userRoles != null) { var managedRoles = userRoles.Select(u => u.As <ManagedRole>()); roles.AddRange(managedRoles.Where(m => m != null).Select(m => m.Name)); } return(new UserOperationRequest { Operation = Operation.Create, User = userName, Password = userPassword, Tenant = userTenant, Roles = roles }); }
//--------------------------------------------------------------------------------------------------------- /// <summary> /// Загрузка всех ролей пользователя /// </summary> /// <param name="user_managers">Менеджер пользователей</param> /// <returns>Задача выполения</returns> //--------------------------------------------------------------------------------------------------------- public async Task LoadAllRolesName(UserManager <CUser> user_managers) { RoleNames.Clear(); RoleNames.AddRange(await user_managers.GetRolesAsync(this)); }