1
frankblack
getGroups ...
  • 2010/2/13 14:11

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


... should get the groups the current user is in. Right?

To get the groups array you can use this code:
$groupsb = (is_object($xoopsUser)) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
echo 
implode(' ',$groupsb);


Test case 1: my user admin with uid 1 is in the groups admins and registered users, so what do you expect to be printed?

Right! 1 2

Test case 2: my user admin with uid 1 is in the groups admins, so what do you expect to be printed?

Right! 1

WRONG! It prints 1 2

Why is this so? I can't find any solution for this "odd" behaviour. When this is expected behaviour, then this is bollocks. I made a fresh install of 2.4.4 to avoid any collisions and if I remember correctly in the 2.0 series it worked as I expected.

2
ghia
Re: getGroups ...
  • 2010/2/13 14:47

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


As it should return the group link records, are you sure for case 2 the link to registered users was deleted?
Check with phpMyAdmin the records returned by:
SELECT groupid FROM xoops_groups_users_link WHERE uid1;
(xoops_ = prefix_)

PS: It is possible that you need to log out and in to see the effects of group manipulation!

3
frankblack
Re: getGroups ...
  • 2010/2/13 15:05

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


You are correct ghia. You have to log out or manually kill the session/cookies to see an effect. Feeling a bit uncomfortable with this anyway. I know that this is a scenario which will happen not to often (or never): Let's assume the admin gave user frankblack accidently admin rights. frankblack logs in and has admin rights. The admin notices his mistakes and moves frankblack out of the admin group, but while frankblack is online he has still access to admin area?

Theoretically spoken...

4
ghia
Re: getGroups ...
  • 2010/2/13 18:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I have this here sometimes on XOOPS also. You have a spammer and deny his rights to post, but he can continue posting until he get logged out.

5
sailjapan
Re: getGroups ...

It'd be nice to have a 'Log this user out Now!' button...

6
redheadedrod
Re: getGroups ...

What happens if you delete their sessions file? Dont they sort of automatically get "logged out" as the session no longer exists?

Rodney

7
frankblack
Re: getGroups ...
  • 2010/2/14 16:51

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Added a feature request on sourceforge...

Login

Who's Online

180 user(s) are online (111 user(s) are browsing Support Forums)


Members: 0


Guests: 180


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits