-
Notifications
You must be signed in to change notification settings - Fork 11
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
Made UnityGroup class more generic #98
base: main
Are you sure you want to change the base?
Conversation
sheldor1510
commented
Aug 3, 2023
- Update the UnityGroup class to be more generic #97
This is a good start. Now that you have renamed the pi_groups to unity_groups/unitygroups, you'll now need to build the logic around the UnityGroup class. We had discussed that it would be good to include the frontend and the backend in the same PR so it's easier to test together. |
…er code for new system
@sheldor1510 this PR looks good. I think I had previously said I would add LDAP attributes for groupType, startTime, and endTime. I've thought about it a bit and I think it would be better to store these things in MySQL and use LDAP only for the objects. That being said, could you add to this PR a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into some issues that I left comments on. Unfortunately I can't continue testing because the comment I mentioned with the fatal error prevents me from continuing testing. Once that is resolved I will continue.
In addition, it would be great if you could comment all of the new methods/code that you added. For methods, use phpdoc syntax, which you can find examples in other parts of this code base. Comments will help me track your code a bit better.
Thank you for your work!
return $users; | ||
} | ||
|
||
public function assignRole($role, $uid, $gid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting a fatal error when trying to approve a group request for a class/center using the user [email protected]
. I tried approving the class group using the same user and got this:
Notice: Trying to access array offset on value of type bool in /var/www/unity-web-portal/resources/lib/UnitySQL.php on line 646
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user' cannot be null in /var/www/unity-web-portal/resources/lib/UnitySQL.php:524 Stack trace: #0 /var/www/unity-web-portal/resources/lib/UnitySQL.php(524): PDOStatement->execute() #1 /var/www/unity-web-portal/resources/lib/UnitySQL.php(751): UnityWebPortal\lib\UnitySQL->assignRole() #2 /var/www/unity-web-portal/resources/lib/UnityGroup.php(538): UnityWebPortal\lib\UnitySQL->assignSuperRole() #3 /var/www/unity-web-portal/resources/lib/UnityGroup.php(172): UnityWebPortal\lib\UnityGroup->init() #4 /var/www/unity-web-portal/webroot/admin/group-mgmt.php(25): UnityWebPortal\lib\UnityGroup->approveGroup() #5 {main} thrown in /var/www/unity-web-portal/resources/lib/UnitySQL.php on line 524
I haven't tracked down the origin of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on this. Keep in mind that I am reproducing the notes in this review in Firefox, but that shouldn't cause an issue as most of this is server-side code.
A few other more generic things:
- The user management page takes a very long time to load, can you reproduce that?
For the next iteration, let's test the following cases:
- A non-admin user requesting to join a non-admin group
- Test approve/deny from the account that owns the group
- A non-admin user requesting any of the 3 example group types
- An admin approving or denying all of the 3 example group types
<input type='hidden' name='pi' value='" . $group->getPIUID() . "'> | ||
<input type='submit' value='Leave Group'> | ||
<input type='hidden' name='pi' value='" . $group->getGroupUID() . "'> | ||
<input type='submit' value='Leave Group' style='margin-top: 0px'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pressing on the Leave Group
button on the groups page initially shows a dialog but then immediately redirects to the group details page.
<form id="newGroupForm" action="" method="POST"> | ||
<p>Fill in the following information to request a new group</p> | ||
<div> | ||
<strong>Type of Group</strong><br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For specifically the PI group type, I am unable to request a new group. The page refreshes but nothing happens. The other 2 types work fine.
$group_type = $_POST["group_type"]; | ||
$group_name = $_POST["group_name"]; | ||
$group_uid = $group_type . "_" . $group_name; | ||
$group = new UnityGroup($group_uid, $LDAP, $SQL, $MAILER, $REDIS, $WEBHOOK); | ||
$group->approveGroup($_POST["uid"], $OPERATOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to approve any group, I get this php error. In my case the requestor of the group is [email protected]
and the approver is also [email protected]
.
Notice: Trying to access array offset on value of type bool in /var/www/unity-web-portal/resources/lib/UnitySQL.php on line 649
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user' cannot be null in /var/www/unity-web-portal/resources/lib/UnitySQL.php:524 Stack trace: #0 /var/www/unity-web-portal/resources/lib/UnitySQL.php(524): PDOStatement->execute() #1 /var/www/unity-web-portal/resources/lib/UnitySQL.php(766): UnityWebPortal\lib\UnitySQL->assignRole() #2 /var/www/unity-web-portal/resources/lib/UnityGroup.php(538): UnityWebPortal\lib\UnitySQL->assignSuperRole() #3 /var/www/unity-web-portal/resources/lib/UnityGroup.php(172): UnityWebPortal\lib\UnityGroup->init() #4 /var/www/unity-web-portal/webroot/admin/group-mgmt.php(25): UnityWebPortal\lib\UnityGroup->approveGroup() #5 {main} thrown in /var/www/unity-web-portal/resources/lib/UnitySQL.php on line 524
This PR covers the issue described here. In its current state it should be feature complete. The remaining things to touch on are:
The entire goal of this PR is making groups on the web portal generic. This means that people deploying the web portal define the group types and requirements, and users can select these. Before this PR, The issue linked about goes into all of this in more detail, so this is just an overview. |