Skip to content

stored max id values in sitevars table #84

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

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

sheldor1510
Copy link
Collaborator

  • Made new table sitevars (Structure: id, name, value)
  • Initially maximum uid, gid, pigid need to be stored in the table with names as MAX_UID, MAX_GID, MAX_PIGID.
  • Then, whenever a new user, group, or pi group is created, the id assigned is an increment of the maximum value by 1.
  • Store the maximum uid for the next user #76

@sheldor1510 sheldor1510 requested a review from hakasapl June 9, 2023 16:28
Copy link
Collaborator

@hakasapl hakasapl left a comment

Choose a reason for hiding this comment

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

In all three methods, could you add an additional bit of logic that checks the LDAP DB to make sure that $new_uid is not currently being used by an ldap object? You only need to check the OU that corresponds ot the method. If it is used, increment 1 to the value and check again, so this should probably be a while loop.

@hakasapl
Copy link
Collaborator

hakasapl commented Jun 9, 2023

It looks like there is already a method header for UIDNumInUse, but it just returns false. You can use that header

@sheldor1510 sheldor1510 requested a review from hakasapl June 9, 2023 16:53
return $id;
$UnitySQL->updateSiteVar('MAX_GID', $new_gid);

return $new_gid;
}

private function UIDNumInUse($id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer if you made 2 additional methods for GIDNumInUse and PIGIDNumInUse to keep it consistent.

sheldor1510 and others added 2 commits June 9, 2023 12:09
Co-authored-by: Hakan Saplakoglu <hakansaplakog@gmail.com>
@sheldor1510 sheldor1510 requested review from hakasapl and removed request for hakasapl June 9, 2023 17:13
@sheldor1510 sheldor1510 requested a review from hakasapl June 9, 2023 17:16
Copy link
Collaborator

@hakasapl hakasapl left a comment

Choose a reason for hiding this comment

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

Cool! Thanks

@hakasapl hakasapl merged commit bf2e212 into UnityHPC:main Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants