duanjianshen4871 2010-04-02 15:21 采纳率: 100%
浏览 33
已采纳

adldap类,需要在两组中搜索用户

http://adldap.sourceforge.net/wiki/doku.php?id=api_user_functions#user_ingroup_username_group_recursive_null

I am using the adLDAP class above to authenticate users against our ldap server.

I was wondering how I could check multiple groups to see if the user belongs to either, if they belong to either.

I don't know if

user_ingroup($username,$group,$recursive=NULL);

can handle search two different groups for the user, need help coding it to search for the user in two different groups, and as soon as it finds it in one of those, break the operation and set a variable to true.

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • duanca3415 2010-04-02 15:30
    关注
    <?php
    $groups = array("FACULTY","STAFF");
    
    if(isset($_SESSION['user_session'])) {
        $username = $_SESSION['user_session'];
        foreach ($groups as $i => $group) {
          $user_in_group = $adldap->user_ingroup($username,$group);
          print '<h1>group '.$user_in_group.'</h1>';
          if($user_in_group) {
            break;
          }
        }
    }?>
    

    Figured it out, unless there is a better way, let me know. Thank you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试