Invited non-admin users cannot set their password: set-password requires 'create user' permission
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 90/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- php
- 领域
- api, authorization, backend
调研方向
从 Fleetbase\Http\Controllers\Internal\v1\UserController::setCurrentUserPassword() 开始,将其授权属性与当前用户相关的同级 endpoint(例如 changeCurrentUserEmail 和 acceptCompanyInvite)进行比较。验证已认证的受邀非管理员用户设置密码的请求不再需要创建用户权限,并且能够成功完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Fleetbase\Http\Controllers\Internal\v1\UserController::setCurrentUserPassword() (POST /int/v1/users/set-password) is missing the #[SkipAuthorizationCheck] attribute that its sibling "current user" endpoints have (changeCurrentUserEmail, acceptCompanyInvite, setUserLocale, …). The authorization layer therefore applies the default permission for a POST on users, which is create user.
Impact
A newly invited user who is not an administrator cannot set their initial password. After accepting the invitation, the console opens the "Set a new password" modal (needs_password: true), and saving it fails with:
User is not authorized to create user
The modal has no close/decline button, so the user is stuck. Administrators are not affected because they hold the create user permission, which hides the bug.
Versions
Fleetbase v0.7.63 (core-api v1.6.62).
Reproduction
- IAM → Users → invite a new user with a non-admin role (e.g. Operations Manager from Fleet-Ops).
- Accept the invitation from the email.
- Enter and confirm a password in the "Set a new password" modal →
POST /int/v1/users/set-password→ error "User is not authorized to create user".
Suggested fix
#[SkipAuthorizationCheck]
public function setCurrentUserPassword(UpdatePasswordRequest $request)
The method only acts on $request->user(), so it needs authentication but no IAM permission.
Workaround
The invited user (already active after accepting) uses "Forgot your password?" on the login page to set the password by email.
- 主要语言
- PHP
- 星标
- 17
- 派生
- 39
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 18
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fleetbase/core-api 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
查看 fleetbase/core-api 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
sync-en
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 2 天内回复
-
[Area] REST API [Type] Documentation Good First Issue
难度 1/5 1-3 小时 新手友好度 90/100
WordPress/presence-api#584 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100