Closed marc-farre closed 1 year ago
@luke- https://github.com/humhub/rest/pull/144 fixes the problem for the status
property.
For authclient
and authclient_id
, see above (I did no test for my proposal).
@luke- This PR is related to the https://github.com/humhub/rest/pull/140 which was done only for update
action, so yes we need the same fix for create
action as well.
@marc-farre @yurabakhtin Thanks!
Steps to reproduce:
Create a new user using https://marketplace.humhub.com/module/rest/docs/html/user.html#tag/User/paths/~1user/post
In the POST data, set the
status
to2
:The new user has status
1
.This is because no scenario is defined on the
User
model before loading data. And with no scenario, thestatus
property is no returnedUser::safeAttributes()
.So we need to set the scenario to
User::SCENARIO_EDIT_ADMIN
.Problem:
authclient
andauthclient_id
are still not safe attributes withUser::SCENARIO_EDIT_ADMIN
.Solution 1: in
User::scenarios()
, add'authclient', 'authclient_id'
to$scenarios[self::SCENARIO_EDIT_ADMIN]
Solution 2: create a new one such as
User::SCENARIO_REST_API_EDIT_ADMIN
. And inUser::scenarios()
we could add: