{"record":{"id":"fa5e9018c422aa3d","repo":"infiniflow/ragflow","slug":"not-implement-update-user-role-user-name-to-ro","errorCode":null,"errorMessage":"not implement: update user role: {user_name} to role {role_name}","messagePattern":"not implement: update user role: (.+?) to role (.+?)","errorType":"http","errorClass":"AdminException","httpStatus":400,"severity":"warning","filePath":"admin/server/roles.py","lineNumber":70,"sourceCode":"        raise AdminException(error_msg)\n\n    @staticmethod\n    def grant_role_permission(role_name: str, actions: list, resource: str) -> Dict[str, Any]:\n        error_msg = f\"not implement: grant role {role_name} actions: {actions} on {resource}\"\n        logging.error(error_msg)\n        raise AdminException(error_msg)\n\n    @staticmethod\n    def revoke_role_permission(role_name: str, actions: list, resource: str) -> Dict[str, Any]:\n        error_msg = f\"not implement: revoke role {role_name} actions: {actions} on {resource}\"\n        logging.error(error_msg)\n        raise AdminException(error_msg)\n\n    @staticmethod\n    def update_user_role(user_name: str, role_name: str) -> Dict[str, Any]:\n        error_msg = f\"not implement: update user role: {user_name} to role {role_name}\"\n        logging.error(error_msg)\n        raise AdminException(error_msg)\n\n    @staticmethod\n    def get_user_permission(user_name: str) -> Dict[str, Any]:\n        error_msg = f\"not implement: get user permission: {user_name}\"\n        logging.error(error_msg)\n        raise AdminException(error_msg)\n","sourceCodeStart":52,"sourceCodeEnd":77,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/admin/server/roles.py#L52-L77","documentation":"RoleMgr.update_user_role (admin/server/roles.py:70) is a stub: logs 'not implement: update user role: {user_name} to role {role_name}' and raises AdminException. Assigning roles to users is unimplemented, so user-to-role mapping requests always fail without side effects.","triggerScenarios":"Calling RoleMgr.update_user_role(user_name, role_name) via an admin user-management endpoint that delegates to it.","commonSituations":"Onboarding flows trying to put users into roles; admins assuming RAGFlow has role-based user assignment like conventional portals.","solutions":["Use the implemented mechanisms: change tenant role (UserTenantRole via tenant APIs) or is_superuser in the DB.","Implement the method in a fork backed by your own role-mapping table."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from api.common.exceptions import AdminException\ntry:\n    RoleMgr.update_user_role(user, role)\nexcept AdminException as e:\n    if str(e).startswith(\"not implement\"):\n        # assign tenant role / is_superuser via implemented user/tenant APIs instead\n        raise NotImplementedError(\"user-role assignment unsupported\") from e\n    raise","preventionTips":["Use tenant role changes (UserTenantRole) for user privilege changes.","Keep onboarding flows away from RoleMgr until it is implemented upstream."],"tags":["not-implemented","roles","rbac","user-management","admin"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}