当前位置: 首页>>代码示例>>PHP>>正文


PHP clladp::AddUserToGroup方法代码示例

本文整理汇总了PHP中clladp::AddUserToGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::AddUserToGroup方法的具体用法?PHP clladp::AddUserToGroup怎么用?PHP clladp::AddUserToGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clladp的用法示例。


在下文中一共展示了clladp::AddUserToGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DeleteGroup

function DeleteGroup()
{
    if (isset($_GET["DeleteGroup"])) {
        $gpid = $_GET["DeleteGroup"];
    }
    if (isset($_GET["delgroup"])) {
        $gpid = $_GET["delgroup"];
    }
    $ou = $_GET["ou"];
    $ldap = new clladp();
    $tpl = new templates();
    $classGroup = new groups($gpid);
    $hashgroup = $ldap->GroupDatas($gpid);
    $default_dn_nogroup = "cn=nogroup,ou=groups,ou={$ou},dc=organizations,{$ldap->suffix}";
    if (!$ldap->ExistsDN($default_dn_nogroup)) {
        $ldap->AddGroup("nogroup", $ou);
    }
    $nogroup_id = $ldap->GroupIDFromName($ou, "nogroup");
    if (is_array($hashgroup["members"])) {
        while (list($num, $val) = each($hashgroup["members"])) {
            $ldap->AddUserToGroup($nogroup_id, $num);
        }
    }
    $users = new usersMenus();
    if ($users->KAV_MILTER_INSTALLED) {
        $sock = new sockets();
        $sock->getfile("KavMilterDeleteRule:{$classGroup->groupName}.{$classGroup->ou}");
    }
    $kas_dn = "cn={$gpid},cn=kaspersky Antispam 3 rules,cn=artica,{$ldap->suffix}";
    if ($ldap->ExistsDN($kas_dn)) {
        $ldap->ldap_delete($kas_dn, false);
    }
    $ldap->ldap_delete($hashgroup["dn"], false);
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
    } else {
        echo $tpl->_ENGINE_parse_body('{success}');
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:39,代码来源:domains.edit.group.php

示例2: AddMemberGroup

function AddMemberGroup()
{
    $usr = new usersMenus();
    $tpl = new templates();
    writelogs("Adding user {$_GET["user"]} to group {$_GET["AddMemberGroup"]}", __FUNCTION__, __FILE__, __LINE__);
    if ($usr->AllowAddGroup == false) {
        writelogs("The administrator have no provileges to execute this operation....", __FUNCTION__, __FILE__, __LINE__);
        echo $tpl->_ENGINE_parse_body('{no_privileges}');
        echo Page($_GET["user"]);
        exit;
    }
    if (trim($_GET["AddMemberGroup"] == null)) {
        return null;
    }
    $ldap = new clladp();
    $ldap->AddUserToGroup($_GET["AddMemberGroup"], $_GET["user"]);
    if ($ldap->ldap_last_error != null) {
        echo $ldap->ldap_last_error;
    } else {
        $tpl = new templates();
        echo html_entity_decode($tpl->_ENGINE_parse_body("{success}: {$_GET["user"]} to group {$_GET["AddMemberGroup"]}"));
        writelogs("Adding user {$_GET["user"]} to group {$_GET["AddMemberGroup"]} => SUCCESS", __FUNCTION__, __FILE__, __LINE__);
    }
    die;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:domains.edit.user.php

示例3: AddnewMember

function AddnewMember()
{
    $user = $_GET["AddnewMember"];
    $user = replace_accents($user);
    $ldap = new clladp();
    $ou = $_GET["ou"];
    $uid = str_replace(' ', '.', $user);
    if (stripos($user, '@') > 0) {
        $mail = $user;
        $tbl = explode('@', $user);
        $domainName = $tbl[1];
        $user = $tbl[0];
        $uid = str_replace(' ', '.', $user);
        if (preg_match('#([a-z0-9]+)([\\.\\-_])([a-z0-9_\\-\\.]+)#', $user, $reg)) {
            $firstname = $reg[1];
            $lastname = $reg[3];
        } elseif (preg_match('#(.+)\\s+(.+)#', $user, $reg)) {
            $firstname = $reg[1];
            $lastname = $reg[2];
        } elseif (preg_match('#(.+)#', $user, $reg)) {
            $lastname = $reg[1];
            $firstname = $lastname;
        }
    } else {
        if (preg_match('#([a-z0-9_\\-]+)\\s+([a-z0-9_\\-]+)#', $user, $reg)) {
            $lastname = $reg[2];
            $firstname = $reg[1];
            $domainName = 'none';
        } else {
            $lastname = $user;
            $firstname = $user;
            $domainName = 'none';
        }
    }
    $dn = "cn={$user},ou=users,ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($lastname == null) {
        $lastname = "unknown";
    }
    if ($firstname == null) {
        $firstname = "unknown";
    }
    if ($domainName == null) {
        $domainName = "unknown";
    }
    if ($mail == null) {
        $mail = "{$lastname}.{$firstname}@{$domainName}";
    }
    $update_array["cn"][] = $user;
    $update_array["uid"][] = $uid;
    $update_array["sn"][] = $lastname;
    $update_array["domainName"][] = $domainName;
    $update_array["homeDirectory"][] = "/home/{$firstname}.{$lastname}";
    $update_array["accountGroup"][] = "0";
    $update_array["accountActive"][] = 'TRUE';
    $update_array["mailDir"] = 'cyrus';
    $update_array["objectClass"][] = "userAccount";
    $update_array["objectClass"][] = "top";
    $update_array["objectClass"][] = "organizationalPerson";
    $ldap->ldap_add($dn, $update_array);
    if ($ldap->ldap_last_error != null) {
        if ($ldap->ldap_last_error != null) {
            echo "Error: Add new member attributes line " . __LINE__ . "\n******\n{$ldap->ldap_last_error}\n******\n";
        }
        exit;
    }
    $ldap->ldap_last_error = null;
    $update_array = null;
    $update_array["givenName"][] = $firstname;
    $update_array["mail"][] = $mail;
    $update_array["DisplayName"][] = "{$firstname} " . $lastname;
    $update_array["MailBoxActive"][] = "FALSE";
    $update_array["objectclass"][] = "ArticaSettings";
    $ldap->Ldap_add_mod($dn, $update_array);
    if ($ldap->ldap_last_error != null) {
        echo "Error line" . __LINE__ . "\nModify attributes\n{$ldap->ldap_last_error}\n";
    }
    $ldap->ldap_last_error = null;
    if (isset($_GET["group_member_id"])) {
        $ldap->AddUserToGroup($_GET["group_member_id"], $user);
    }
    if ($ldap->ldap_last_error == null) {
        echo $uid;
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:84,代码来源:domains.manage.users.index.php

示例4: AddMemberGroup

function AddMemberGroup()
{
    $usr = new usersMenus();
    $tpl = new templates();
    writelogs("Adding user {$_POST["user"]} to group {$_POST["AddMemberGroup"]}", __FUNCTION__, __FILE__, __LINE__);
    if ($usr->AllowAddGroup == false) {
        writelogs("The administrator have no provileges to execute this operation....", __FUNCTION__, __FILE__, __LINE__);
        echo $tpl->javascript_parse_text('{no_privileges}');
        return;
    }
    if (trim($_POST["AddMemberGroup"] == null)) {
        echo "Error:AddMemberGroup -> NO value...";
        return;
    }
    $ldap = new clladp();
    if (!$ldap->AddUserToGroup($_POST["AddMemberGroup"], $_POST["user"])) {
        echo "Error:{$_POST["AddMemberGroup"]}->{$_POST["user"]}\n{$ldap->ldap_last_error}";
        return;
    }
    $tpl = new templates();
    echo $tpl->javascript_parse_text("{success}: {$_POST["user"]} to group {$_POST["AddMemberGroup"]}");
    writelogs("Adding user {$_POST["user"]} to group {$_POST["AddMemberGroup"]} => SUCCESS", __FUNCTION__, __FILE__, __LINE__);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:23,代码来源:domains.group.user.affect.php

示例5: clladp

 function process_array()
 {
     $ldap = new clladp();
     $this->ClassLdap = $ldap;
     while (list($num, $ligne) = each($this->array_content)) {
         $this->logs("Process {$num}\n*******************************\n{$ligne}");
         if ($this->Parse_array($ligne)) {
             if ($this->ProcessGroup() == false) {
                 $this->logs("Process group failed");
             }
             if ($this->Adduser() == true) {
                 $this->logs("success");
                 if ($ldap->AddUserToGroup($this->group_id, $this->userid) == false) {
                     $this->logs("Failed to add group {$this->group_id} for {$this->userid}\n{$ldap->ldap_last_error}\n");
                 }
             } else {
                 $this->countFailed = $this->countFailed + 1;
             }
         } else {
             $this->countFailed = $this->countFailed + 1;
         }
     }
 }
开发者ID:brucewu16899,项目名称:artica,代码行数:23,代码来源:export.listener.php


注:本文中的clladp::AddUserToGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。