Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« on: May 08, 2012, 04:02:49 PM » |
|
Hey Everyone, When I add a quota to a group it effects everyone who is not already in a group. I would just put everyone inside of a group, but since I expect certain people to sign in through the access directory they will see this error before I have time to add them to a group. Is there a way to fix this? Thank you!
|
|
|
|
|
Logged
|
|
|
|
GuiValarelli
Newbie
Karma: 0
Posts: 7
Tempus Fugit!
|
 |
« Reply #1 on: May 08, 2012, 04:08:25 PM » |
|
What is the efect on those who wasnt associated with a group yet? An error message, or an efect of the quota itself? I ask this because i havent explored the quota funcionality yet
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #2 on: May 08, 2012, 04:16:53 PM » |
|
They seem to be affected by all the quotas I have created. Also I made a user part of one group where he has quota that limits him to 0 hours on all the resources. That worked fine, but when I added him to a new group with no quota on it he was no longer affected by the other groups quota. I finally added him to one more group with a quota similar to the first one, be he was still unaffected by it
|
|
|
|
|
Logged
|
|
|
|
GuiValarelli
Newbie
Karma: 0
Posts: 7
Tempus Fugit!
|
 |
« Reply #3 on: May 08, 2012, 04:25:31 PM » |
|
ill replicate that condition here, and see if something comes out...
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #4 on: May 08, 2012, 04:36:00 PM » |
|
Thanks a lot!
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #5 on: May 10, 2012, 05:05:06 PM » |
|
I have done some more experimenting and it appears that as soon as you are in multiple groups, none of the quotas work.
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #6 on: May 11, 2012, 05:28:14 PM » |
|
Ive done some experimenting with the code, and the reason that users who are not in a group are affected by quotas is because quotaexceededexception is being called. The reason that people who are in multiple groups are not affected by the quotas is because for some reason appliestogroup function returning a false statement. The function is: public function AppliesToGroup($groupId) { return is_null($this->groupId) || $this->groupId == $groupId; }
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #7 on: May 11, 2012, 05:28:47 PM » |
|
still not sure why this is happening but I'm working on it 
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5403
|
 |
« Reply #8 on: May 14, 2012, 01:33:12 PM » |
|
I'll take a look. Thanks!
|
|
|
|
|
Logged
|
|
|
|
Alecardo
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #9 on: May 25, 2012, 11:09:08 PM » |
|
So, I think I finally figured out the problem. The problem is that in this part of the ExceedsQuota function. foreach ($user->Groups() as $group) { if (!$this->AppliesToGroup($group->GroupId)) { return false; } } If a user is in multiple groups, then as soon as part returns a false, then the user is able to make the reservation. The problem is that a person could be in a quota could have a group id of 3, but the user could be in two groups. One group has an id of 1 and the second group has an id of 3. So on the first part attempt of the loop this statdment would return a false and then the reservation would be made. At least I think thats what is going on. To fix this I changed the beginning of exceedsquta function to: public function ExceedsQuota($reservationSeries, $user, $schedule, IReservationViewRepository $reservationViewRepository) { //Alec added this $previousgrouperror = false; //Alec added this $timezone = $schedule->GetTimezone();
foreach ($reservationSeries->AllResourceIds() as $resourceId) { if (!$this->AppliesToResource($resourceId) ) //Alec added the error part { return false; } }
foreach ($user->Groups() as $group) { if (!$this->AppliesToGroup($group->GroupId)&& !$previousgrouperror) { $previousgrouperror = false; } if ($this->AppliesToGroup($group->GroupId)) { $previousgrouperror = true; } } if(!$previousgrouperror) { return false; } So far it seems to be working. I would like peoples input on it if there is any trouble with this it. Thanks!
|
|
|
|
|
Logged
|
|
|
|
Nick
Administrator
Hero Member
   
Karma: 15
Posts: 5403
|
 |
« Reply #10 on: May 29, 2012, 01:15:15 PM » |
|
Looks like the right fix to me. I'll incorporate this. Thanks!
|
|
|
|
|
Logged
|
|
|
|
|