Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am using Umbraco 9.3.1 and when attempting to get an user it's returning 404
task.usersIds = task.AssignedToIds.split(','); usersResource.getUsers(task.usersIds).then(function (data) { task.users = data.data; })
even though it's documented in the API page https://apidocs.umbraco.com/v9/ui/#/api/umbraco.resources.usersResource
Hi Carlos,
Does your user has access to the users section ? I think that is needed to call the API.
Dave
Yes, it's the master admin (user id -1)
I see the error that you are trying to retrieve a user with Id 1. Does that exist ?
If I look at the source of the controller in Umbraco I see it returns Notfound (404) when the parameter is null
https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs#L307
Yes, the user 1 exists, and I did log in with it to make sure it wasn't inactive.
About the not found, what parameter is missing? I'm using an array of user ids, as it describes in the documentation. Is it being sent incorrectly?
Could you log task.userIds to see if it is an aray ?
yes it is :)
even if I parse into integers, same error
Can you try to convert it to array of integers ?
Yes I did, see the second screenshot, please ;)
I think you stumbled onto a bug in Umbraco.
As you can see in the UserController GetByIds method has the AdminUserEditsRequireAdmin authorization policy applied. See https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs#L305
But when I took a closer look on how that works this only allows the querystrings id or userIds to be processed. See https://github.com/umbraco/Umbraco-CMS/blob/39423d039d479f3381e9b980977fee0015477721/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.BackOfficeAuth.cs#L190
But the calls made from the backoffice use the querystring parameter ids
I think the best way to go for now is to log the issue on the tracker : https://github.com/umbraco/Umbraco-CMS/issues
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
usersResource.getUsers returning 404
I am using Umbraco 9.3.1 and when attempting to get an user it's returning 404
even though it's documented in the API page https://apidocs.umbraco.com/v9/ui/#/api/umbraco.resources.usersResource
Hi Carlos,
Does your user has access to the users section ? I think that is needed to call the API.
Dave
Yes, it's the master admin (user id -1)
Hi Carlos,
I see the error that you are trying to retrieve a user with Id 1. Does that exist ?
Dave
Hi Carlos,
If I look at the source of the controller in Umbraco I see it returns Notfound (404) when the parameter is null
https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs#L307
Dave
Yes, the user 1 exists, and I did log in with it to make sure it wasn't inactive.
About the not found, what parameter is missing? I'm using an array of user ids, as it describes in the documentation. Is it being sent incorrectly?
Could you log task.userIds to see if it is an aray ?
Dave
yes it is :)
even if I parse into integers, same error
Can you try to convert it to array of integers ?
Dave
Yes I did, see the second screenshot, please ;)
Hi Carlos,
I think you stumbled onto a bug in Umbraco.
As you can see in the UserController GetByIds method has the AdminUserEditsRequireAdmin authorization policy applied. See https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs#L305
But when I took a closer look on how that works this only allows the querystrings id or userIds to be processed. See https://github.com/umbraco/Umbraco-CMS/blob/39423d039d479f3381e9b980977fee0015477721/src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.BackOfficeAuth.cs#L190
But the calls made from the backoffice use the querystring parameter ids
I think the best way to go for now is to log the issue on the tracker : https://github.com/umbraco/Umbraco-CMS/issues
Dave
is working on a reply...