agi2016
(Just in Town)
2017-01-24 02:58 PM
IF Ingroup LIKE groupname*

Hi,
i have the problem to found out which memberships the user has, by using the following code:
we have several grounames like SYS_MIKE_xyz and want to check if the user is in one of these groups to map a share:


The following works:
if ingroup("SYTEM_MIKE_TEST1")
use Z: /delete /persistent
use Z: $Filsrv1 + "ShareX"
endif

The following works NOT by using the spaceholder (*):
if ingroup("SYTEM_MIKE_TEST*")
use Z: /delete /persistent
use Z: $Filsrv1 + "ShareX"
endif


AllenAdministrator
(KiX Supporter)
2017-01-24 03:54 PM
Re: IF Ingroup LIKE groupname*

Ingroup does not have this functionality. There are other group UDFs including GetADUserGroups - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=198609#Post198609

Something like this should work... untested.

 Code:
$UserGroups=GetADUserGroups()
if ascan($Usergroups,"SYTEM_MIKE_TEST",,,1)
  ;do stuff
endif


How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1


AllenAdministrator
(KiX Supporter)
2017-01-31 06:35 PM
Re: IF Ingroup LIKE groupname*

I realize this guy is probably not coming back but I felt like this was moderately interesting.

Again Untested, and still requires the GetADUserGroups UDF linked above.

 Code:
Function InGroupLIKE($LikeGroup,optional $Groups)
  if ubound($groups)=-1
    $groups=GetADUserGroups()
  endif
  $InGroupLIKE=iif(ascan($groups,$LikeGroup,,,1)>-1,1,0)  
Endfunction