PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WEBDEV 20 - to get group within user groupware
WEBDEV 20 - to get group within user groupware
Débuté par PETER ZHOU, 13 mai 2017 09:32 - 3 réponses
Posté le 13 mai 2017 - 09:32
Hi,

I am using 'gpwAddUser(clUser)' to add the login user.
But how do i add/assign the group within the groupware ?

Regards,

PETER ZHOU
Posté le 13 mai 2017 - 15:50
Hi Peter,

complexity takes its toll ... as you've seen, in Groupware the user's structure doesn't contain a "group" member. This is because on one hand in PC Soft's Groupware a group can be part of another group that itself can be part of another group and so on ... on the other hand a user may not be part of any group. So, rights can be attributed to a group or a single user.

However, the function gpwGetUserInfo(gpwInfoGroup) comes to rescue you!
Posté le 13 mai 2017 - 22:03
Quote
GuenterP

Hi Peter,





complexity takes its toll ... as you've seen, in Groupware the user's structure doesn't contain a "group" member. This is because on one hand in PC Soft's Groupware a group can be part of another group that itself can be part of another group and so on ... on the other hand a user may not be part of any group. So, rights can be attributed to a group or a single user.





However, the function gpwGetUserInfo(gpwInfoGroup) comes to rescue you!

Hi Guenter,

'gpwGetUserInfo(gpwInfoGroup)' is to get the current logon user's group.

I would like to assign the group (which we have fixed to a certain group) when i add the user, how do i do that ?

Regards,

Peter Zhou
Posté le 14 mai 2017 - 07:25
Hi Peter,
afaik there's no cheap solution to get at any user's group without logging her/him in. In fact a user can be member of several groups! There are numerous other problems buried in Groupware. As long as you keep to what it is made for, you're safe. Maybe you can find a code snippet in the groupware's component code to retrieve the group? Just a suggestion:

PROCEDURE GPU_sGetUserGroups(nUserId is int) sListGroups is string UNICODE // browse the groups of the user HFilter(GPU_User_Group,UserID,nUserId,nUserId) FOR EACH GPU_User_Group ON UserID // retrieve information about the group HReadSeekFirst(GPU_Group,IDGroup,GPU_User_Group.IDGroup) IF HFound(GPU_Group) THEN IF sListGroups<>“” THEN sListGroups+=TAB sListGroups+=GPU_Group.Name END END HDeactivateFilter(GPU_User_Group) RESULT sListGroups

If it starts to become nasty, I recommend to write your own groupware. This takes a week but then you're playing by your own rules.