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

PruneUserJob realm bug #126

Closed
2 tasks done
GunniBusch opened this issue Dec 30, 2024 · 2 comments
Closed
2 tasks done

PruneUserJob realm bug #126

GunniBusch opened this issue Dec 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@GunniBusch
Copy link

GunniBusch commented Dec 30, 2024

Current Behavior

If proxmox has users in different realms as specified in

enum RealmType: string
{
case PAM = 'pam';
case PVE = 'pve';
}
PruneUserJob will fail.
The reason is, that convoy gets all users, and converts them into UserData. UserData, casts the realm into said enum.
Consequently there will be an error, before a deletion can occur. See here:
$users = array_map(fn ($user) => UserData::fromRaw($user), $this->getData($response));

To fix this, I would suggest when getting users, first to check if the realm can be casted, and only then creating a Data Object.

Expected Behavior

As pointed out earlier, to ignore users with realm type different than in the enum

Steps to Reproduce

Create a user with a realm eg. openid and run the job PruneUserJob

Screenshots

No response

Proxmox OS Version

/

Operating System

/

Browser

/

Additional Context

No response

Panel Version

4.2.4

Error Logs

No response

Is there an existing issue for this?

  • I have searched the existing issues before opening this issue.
  • I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
@GunniBusch GunniBusch added bug Something isn't working not confirmed The bug isn't confirmed to be reproducible/valid concern labels Dec 30, 2024
GunniBusch added a commit to GunniBusch/panel that referenced this issue Dec 30, 2024
Fixes ConvoyPanel#126

Filter users by realm type before converting them into UserData in the `getUsers` method in `app/Repositories/Proxmox/Node/ProxmoxAccessRepository.php`.

* Add a check to see if the realm type can be casted to the `RealmType` enum before creating a `UserData` object.
* Ignore users with realm types different than those in the enum.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ConvoyPanel/panel/issues/126?shareId=XXXX-XXXX-XXXX-XXXX).
@ericwang401
Copy link
Collaborator

Hello, thanks for your report! When is realm type not defined as pam or pve?

@ericwang401 ericwang401 added the question Further information is requested label Dec 31, 2024
@GunniBusch
Copy link
Author

GunniBusch commented Dec 31, 2024

Hello, thanks for your report! When is realm type not defined as pam or pve?

For example if someone uses openid.

https://pve.proxmox.com/wiki/User_Management#pveum_authentication_realms

But I see that the realm types are fixed. So you can add the missing ones to the enum:


ad | ldap | openid | pam | pve

I can update the pr

@ericwang401 ericwang401 removed question Further information is requested not confirmed The bug isn't confirmed to be reproducible/valid concern labels Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants