Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed userResource request to get all users #18105

Open
wants to merge 1 commit into
base: v13/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed userResource request to get all users.
  • Loading branch information
AndyButland committed Jan 24, 2025
commit 69b35c8de26cb274540e3380634779e5bbaf8306
2 changes: 1 addition & 1 deletion src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public ActionResult<string[]> PostClearAvatar(int id)
/// <returns></returns>
[OutgoingEditorModelEvent]
[Authorize(Policy = AuthorizationPolicies.AdminUserEditsRequireAdmin)]
public ActionResult<IEnumerable<UserDisplay?>> GetByIds([FromJsonPath] int[] ids)
public ActionResult<IEnumerable<UserDisplay?>> GetByIds([FromQuery] int[] ids)
{
if (ids == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
{
policy.AuthenticationSchemes.Add(backOfficeAuthenticationScheme);
policy.Requirements.Add(new AdminUsersRequirement());
policy.Requirements.Add(new AdminUsersRequirement("ids"));

Check warning on line 205 in src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.BackOfficeAuth.cs

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v13/dev)

❌ Getting worse: Large Method

CreatePolicies increases from 283 to 284 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
policy.Requirements.Add(new AdminUsersRequirement("userIds"));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,14 @@
*/
function getUsers(userIds) {

var idQuery = "";
userIds.forEach(id => idQuery += `ids=${id}&`);
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"userApiBaseUrl",
"GetByIds",
{ ids: userIds })),
idQuery)),
"Failed to retrieve data for users " + userIds);
}

Expand Down
Loading