public static RoleData ToData(RoleDto dto) { return new RoleData() { Id = dto.Id, Text = dto.Text, }; }
public bool UserIsInRole(RoleDto role) { return(User.Roles != null && User.Roles.Any(r => r == role.DisplayName)); }
protected Task OnResetSearchAsync(RoleDto dto) { dto.RoleName = null; return(Task.CompletedTask); }
public async Task <IActionResult> AddRole(RoleDto dto) { var result = await _roleService.CreateRole(dto); return(Ok(result)); }
public Task <bool> Add(RoleDto model) { throw new NotImplementedException(); }
private void ValidateRole(RoleDto roleDto) { //throw new NotImplementedException(); }
public void AddRole(RoleDto role) { _repository.AddRole(RoleDtoToRoleConvert(role)); }
public async Task <IActionResult> Save(RoleDto model) { await _service.SaveAsync(model); return(JsonData(true)); }
public bool CreateRole(RoleDto role) { throw new NotImplementedException(); }
public UserDto() { Role = new RoleDto(); }
public void Update(RoleDto role) { roleServiceClient.Update(role); }
public RoleDto Get(string id = null, string name = null) { RoleDto role = roleServiceClient.Get(id, name); return(role); }
public string Create(RoleDto role) { string id = roleServiceClient.Create(role); return(id); }
public ActionResult <RoleDto> AddRole(RoleDto roleDto) { RoleDto createdRole = _roleService.AddRole(roleDto); return(CreatedAtAction(nameof(GetRoleById), new { id = createdRole.Id }, createdRole)); }
private RoleDto GetRole(int roleId) { return(RoleDto.FromRoleInfo(RoleController.Instance.GetRoleById(PortalId, roleId))); }
private static void PersistRoleToDataStore(IGalleryServerRole role) { // Update the existing role or insert if it doesn't exist. using (GspContext ctx = new GspContext()) { RoleDto roleDto = ctx.Roles.Find(role.RoleName); if (roleDto == null) { roleDto = new RoleDto { RoleName = role.RoleName, AllowViewAlbumsAndObjects = role.AllowViewAlbumOrMediaObject, AllowViewOriginalImage = role.AllowViewOriginalImage, AllowAddChildAlbum = role.AllowAddChildAlbum, AllowAddMediaObject = role.AllowAddMediaObject, AllowEditAlbum = role.AllowEditAlbum, AllowEditMediaObject = role.AllowEditMediaObject, AllowDeleteChildAlbum = role.AllowDeleteChildAlbum, AllowDeleteMediaObject = role.AllowDeleteMediaObject, AllowSynchronize = role.AllowSynchronize, HideWatermark = role.HideWatermark, AllowAdministerGallery = role.AllowAdministerGallery, AllowAdministerSite = role.AllowAdministerSite }; ctx.Roles.Add(roleDto); } else { roleDto.AllowViewAlbumsAndObjects = role.AllowViewAlbumOrMediaObject; roleDto.AllowViewOriginalImage = role.AllowViewOriginalImage; roleDto.AllowAddChildAlbum = role.AllowAddChildAlbum; roleDto.AllowAddMediaObject = role.AllowAddMediaObject; roleDto.AllowEditAlbum = role.AllowEditAlbum; roleDto.AllowEditMediaObject = role.AllowEditMediaObject; roleDto.AllowDeleteChildAlbum = role.AllowDeleteChildAlbum; roleDto.AllowDeleteMediaObject = role.AllowDeleteMediaObject; roleDto.AllowSynchronize = role.AllowSynchronize; roleDto.HideWatermark = role.HideWatermark; roleDto.AllowAdministerGallery = role.AllowAdministerGallery; roleDto.AllowAdministerSite = role.AllowAdministerSite; } ctx.SaveChanges(); } }
public bool UpdateRole(RoleDto model) { throw new NotImplementedException(); }
public async Task <IActionResult> UpdateRole([FromBody] RoleDto roleDto) { var result = await _authorizationAdminService.UpdateRole(roleDto); return(FromReply(result)); }
//[AbpAuthorize(PermissionNames.Pages_Users)] //[DontWrapResult] //不需要AbpJsonResult public async Task <JsonResult> Update([FromBody] RoleDto input) { var role = await _roleAppService.Update(input); return(Json(role)); }
public void UpdateRole(RoleDto role) { _repository.UpdateRole(RoleDtoToRoleConvert(role)); }
/// <summary> /// Creates a new role. /// </summary> /// <remarks> /// Required permissions: Roles.Create. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='roleDto'> /// </param> public static RoleDto Post(this IRoles operations, RoleDto roleDto) { return(operations.PostAsync(roleDto).GetAwaiter().GetResult()); }
public ActionResult Edit(string moudleId, string menuId, string btnId, RoleDto dto) { roleService.Update(dto); return(RedirectToAction("Index", RouteData.Values)); }
/// <summary> /// Edits a role. /// </summary> /// <remarks> /// Required permissions: Roles.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// key: Id /// </param> /// <param name='roleDto'> /// </param> public static RoleDto PutById(this IRoles operations, int id, RoleDto roleDto) { return(operations.PutByIdAsync(id, roleDto).GetAwaiter().GetResult()); }
public ActionResult Edit(RoleDto[] dtos) { dtos.CheckNotNull("dtos" ); OperationResult result = IdentityContract.EditRoles(dtos); return Json(result.ToAjaxResult()); }
/// <summary> /// Edits a role. /// </summary> /// <remarks> /// Required permissions: Roles.Edit. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// key: Id /// </param> /// <param name='roleDto'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <RoleDto> PutByIdAsync(this IRoles operations, int id, RoleDto roleDto, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PutByIdWithHttpMessagesAsync(id, roleDto, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public IActionResult UpdateRole(RoleDto dto) { var result = _roleService.UpdateRole(dto); return(Ok(result)); }
public async Task <ActionResult <RoleDto> > GetRoleByIdAsync([FromRoute] string id) { RoleDto role = await Mediator.Send(new GetRoleByIdQuery { RoleId = id }); return(Ok(role)); }
public bool UserIsInRole(RoleDto role) { return(User.RoleNames != null && User.RoleNames.Any(r => r == role.NormalizedName)); }
public void Update(RoleDto dto) { this.Update <RoleDto, Role>(dto); }
public async Task <bool> AddRole(RoleDto roleDto) { var role = Role.Create(roleDto.Name); return(await this._roleRep.CreateAsync(role)); }
public void Create(RoleDto dto) { var role = new Role(dto.Name); this._documentStore.Save(role); }
public async Task <ApiResponse> CreateRoleAsync([FromBody] RoleDto roleDto) => await _adminManager.CreateRoleAsync(roleDto);
public static IdentityRole ToEntity(this RoleDto role) { return(Mapper.Map <IdentityRole>(role)); }
/// <summary> /// Return a collection representing the roles for all galleries. If no matching objects /// are found in the data store, an empty collection is returned. /// </summary> /// <returns> /// Returns a collection object representing the roles for all galleries. /// </returns> public static IEnumerable<RoleDto> GetRoles() { List<RoleDto> roles = new List<RoleDto>(); using (IDataReader dr = GetCommandRoles().ExecuteReader(CommandBehavior.CloseConnection)) { string previousRoleName = null; RoleDto role = null; while (dr.Read()) { // SQL: //SELECT r.RoleName, r.AllowViewAlbumsAndObjects, r.AllowViewOriginalImage, r.AllowAddChildAlbum, // r.AllowAddMediaObject, r.AllowEditAlbum, r.AllowEditMediaObject, r.AllowDeleteChildAlbum, // r.AllowDeleteMediaObject, r.AllowSynchronize, r.HideWatermark, r.AllowAdministerGallery, // r.AllowAdministerSite, ra.FKAlbumId //FROM dbo.[dnn_gs_Role] r LEFT OUTER JOIN dbo.[dnn_gs_Role_Album] ra ON r.RoleName = ra.FKRoleName //ORDER BY r.RoleName string roleName = dr.GetString(0); if (!roleName.Equals(previousRoleName, StringComparison.OrdinalIgnoreCase)) { previousRoleName = roleName; role = new RoleDto { RoleName = roleName, AllowViewAlbumsAndObjects = dr.GetBoolean(1), AllowViewOriginalImage = dr.GetBoolean(2), AllowAddChildAlbum = dr.GetBoolean(3), AllowAddMediaObject = dr.GetBoolean(4), AllowEditAlbum = dr.GetBoolean(5), AllowEditMediaObject = dr.GetBoolean(6), AllowDeleteChildAlbum = dr.GetBoolean(7), AllowDeleteMediaObject = dr.GetBoolean(8), AllowSynchronize = dr.GetBoolean(9), HideWatermark = dr.GetBoolean(10), AllowAdministerGallery = dr.GetBoolean(11), AllowAdministerSite = dr.GetBoolean(12) }; roles.Add(role); role.RoleAlbums = new HashSet<RoleAlbumDto>(); } if (role == null) { throw new DataException("The variable 'role' was null. This should never happen."); } if (!dr.IsDBNull(13)) { role.RoleAlbums.Add(new RoleAlbumDto { FKRoleName = roleName, FKAlbumId = dr.GetInt32(13) }); } } } return roles; }
public ActionResult AddRole(RoleDto model) { using (var proxy = new UserServiceClient()) { proxy.CreateRoles(new List<RoleDto> { model }.ToArray()); return RedirectToSuccess("添加账户角色成功!", "Roles", "Admin"); } }