Add user picker property editor (#7613)

This commit is contained in:
Bjarne Fyrstenborg
2020-07-23 16:08:24 +02:00
committed by GitHub
parent 2ca7cc9ccc
commit 41d1e33fc4
15 changed files with 247 additions and 37 deletions

View File

@@ -178,6 +178,33 @@ namespace Umbraco.Web.Editors
return result;
}
/// <summary>
/// Get users by integer ids
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
[OutgoingEditorModelEvent]
[AdminUsersAuthorize]
public IEnumerable<UserDisplay> GetByIds([FromJsonPath]int[] ids)
{
if (ids == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
if (ids.Length == 0)
return Enumerable.Empty<UserDisplay>();
var users = Services.UserService.GetUsersById(ids);
if (users == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
var result = Mapper.MapEnumerable<IUser, UserDisplay>(users);
return result;
}
/// <summary>
/// Returns a paged users collection
/// </summary>

View File

@@ -7,7 +7,8 @@ namespace Umbraco.Web.PropertyEditors
{
public override IDictionary<string, object> DefaultConfiguration => new Dictionary<string, object>
{
{"entityType", "User"}
{ "entityType", "User" },
{ "multiPicker", "0" }
};
}
}
}

View File

@@ -8,8 +8,8 @@ namespace Umbraco.Web.PropertyEditors
{
[DataEditor(
Constants.PropertyEditors.Aliases.UserPicker,
"User picker",
"entitypicker",
"User Picker",
"userpicker",
ValueType = ValueTypes.Integer,
Group = Constants.PropertyEditors.Groups.People,
Icon = Constants.Icons.User)]