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

fix: provision api's status codes #47846

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

hamza221
Copy link
Contributor

@hamza221 hamza221 commented Sep 9, 2024

Summary

addUsercalls editUser which creates inconsistencies in status codes

TODO

More info

OLD

CODE:

New user ( affected by Edit user exceptions )

101: Invalid password value/argument

102: User already exists | Sub-admin group does not exist

103: Cannot create sub-admins for admin group

104: Group does not exist

105: Insufficient privileges for group

106: No group specified (required for sub-admins)

107: Hint exceptions

108: An email address is required, to send a password link to the user.

110: Required email address was not provided

111: Could not create non-existing user ID

Edit user:

101: Invalid argument

102: Invalid Quota /password / language / locale / first day of the week

103: No permission to edit a field / (password policy / Setting the password is not supported by the users backend)

998: user Not found

Documentation

New user:

  • 100 - successful
  • 101 - invalid input data
  • 102 - username already exists
  • 103 - unknown error occurred whilst adding the user
  • 104 - group does not exist
  • 105 - insufficient privileges for group
  • 106 - no group specified (required for subadmins)
  • 107 - all errors that contain a hint - for example “Password is among the 1,000,000 most common ones. Please make it unique.” (this code was added in 12.0.6 & 13.0.1)
  • 108 - password and email empty. Must set password or an email
  • 109 - invitation email cannot be send

Edit user:

  • 100 - successful
  • 101 - user not found
  • 102 - invalid input data

NEW

New user ( affected by Edit user exceptions )

101: Invalid password value/argument

102: User already exists

103: Cannot create sub-admins for admin group

104: Group does not exist

105: Insufficient privileges for group

106: No group specified (required for sub-admins)

107: Hint exceptions

108: An email address is required, to send a password link to the user.

109: Sub-admin group does not exist

110: Required email address was not provided

111: Could not create non-existing user ID

Edit user:

101: Invalid argument /Invalid Quota /password / language / locale / first day of the week

107: password policy (hint exception)

112: Setting the password is not supported by the users backend

113: editing field not allowed/ field doesn’t exist

Checklist

@hamza221 hamza221 added bug 3. to review Waiting for reviews labels Sep 9, 2024
@hamza221 hamza221 self-assigned this Sep 9, 2024
@ChristophWurst
Copy link
Member

@hamza221
Copy link
Contributor Author

hamza221 commented Sep 9, 2024

This is to align with https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/instruction_set_for_users.html, right?

The next step would be to update that too, once this gets approved, both code and documentation have inconsistencies

@nickvergessen
Copy link
Member

These number codes are so ...
I think if we touch/break the existing codes anyway we should migrate to something "readable"

Any specific reason you want to touch them? Or where is this originating from?

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the Talk Android and iOS mobile clients as those are also using the API. But doesn't seem they are checking the exact error code, but are basically either OK or show whatever the message is.
So seems kind of Yolo in that regard and we should just make sure that code matches docs afterwards

@nickvergessen
Copy link
Member

But we have integration tests that ensure the numbers stay. So better to keep those and fix the docs?

@hamza221 hamza221 force-pushed the fix/provisionApi-status-codes branch 2 times, most recently from 966e5e6 to 3128f0d Compare September 27, 2024 11:39
@hamza221
Copy link
Contributor Author

/backport to stable30

@hamza221
Copy link
Contributor Author

/backport to stable29

@hamza221
Copy link
Contributor Author

/backport to stable28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants