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


PHP clladp::GroupIDFromName方法代码示例

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


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

function USER_ADD()
{
    $userid = $_GET["new_userid"];
    $password = $_GET["password"];
    $group_id = $_GET["group_id"];
    $tpl = new templates();
    $email = $_GET["email"] . "@" . $_GET["user_domain"];
    $user = new usersMenus();
    if ($user->EnableVirtualDomainsInMailBoxes == 1) {
        writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
        $userid = $email;
    }
    $users = new user($userid);
    if ($users->UserExists) {
        echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
        return false;
    }
    writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
    $email = $_GET["email"] . "@" . $_GET["user_domain"];
    $ou = $_GET["ou"];
    if ($ou == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
        exit;
    }
    if ($userid == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
        exit;
    }
    if ($password == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
        exit;
    }
    if ($email == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
        exit;
    }
    $ldap = new clladp();
    if ($group_id == null) {
        $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
        if (!$ldap->ExistsDN($default_dn_group)) {
            $ldap->AddGroup("nogroup", $ou);
        }
        $group_id = $ldap->GroupIDFromName($ou, "nogroup");
        if ($group_id == null) {
            $group_id = 0;
        }
    }
    $emT = explode('@', $email);
    //Verify domains --------------------------------------------------------------- 2008 10 05,P3
    $hash_domains_table = $ldap->hash_get_domains_ou($ou);
    if ($hash_domains_table[$_GET["user_domain"]] == null) {
        writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
        writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
        $ldap->AddDomainEntity($ou, $_GET["user_domain"]);
    }
    //------------------------------------------------------------------------------
    $domains = $ldap->domains_get_locals_domains($ou);
    $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($ldap->ExistsDN($dn)) {
        writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
        echo $userid;
        exit;
    }
    $users = new user($userid);
    $users->mail = $email;
    $users->accountGroup = $group_id;
    $users->domainname = $_GET["user_domain"];
    if ($password != null) {
        $users->password = $password;
    }
    $users->ou = $ou;
    if ($domains[$_GET["user_domain"]] == true) {
        writelogs("is a local domain {$_GET["user_domain"]}={$domains[$_GET["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__);
        $upd["ObjectClass"][] = 'ArticaSettings';
        $users->MailboxActive = "TRUE";
    }
    if (!$users->add_user()) {
        echo "ERROR:" . $users->ldap_error;
        exit;
    }
    if ($group_id > 0) {
        $ldap->AddUserToGroup($group_id, $users->uid);
    }
    echo $users->uid;
}
开发者ID:brucewu16899,项目名称:artica,代码行数:85,代码来源:domains.edit.user.php

示例3: USER_ADD

function USER_ADD()
{
    $userid = $_REQUEST["new_userid"];
    $password = $_REQUEST["password"];
    $group_id = $_REQUEST["group_id"];
    if (isset($_GET["encpass"])) {
        $password = url_decode_special_tool($password);
    }
    $ou = $_REQUEST["ou"];
    $tpl = new templates();
    if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) {
        $_REQUEST["user_domain"] = $re[2];
        $_REQUEST["email"] = $re[1];
    }
    $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
    $email = strtolower($email);
    $user = new usersMenus();
    if ($user->EnableVirtualDomainsInMailBoxes == 1) {
        writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
        $userid = $email;
    }
    if (is_numeric($group_id)) {
        $gp = new groups($group_id);
        writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__);
        if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
            $ldap = new clladp();
            $hash = $ldap->OUDatas($ou);
            $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
            $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
            if (is_array($policiespwd)) {
                $priv = new privileges();
                if (!$priv->PolicyPassword($password, $policiespwd)) {
                    return false;
                }
            }
        } else {
            writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    $users = new user($userid);
    if ($users->UserExists) {
        echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
        return false;
    }
    writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
    $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
    if ($ou == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
        exit;
    }
    if ($userid == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
        exit;
    }
    if ($password == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
        exit;
    }
    if ($email == null) {
        echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
        exit;
    }
    $ldap = new clladp();
    if (!is_numeric($group_id)) {
        writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__);
        $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
        if (!$ldap->ExistsDN($default_dn_group)) {
            $ldap->AddGroup("nogroup", $ou);
        }
        $group_id = $ldap->GroupIDFromName($ou, "nogroup");
        if (!is_numeric($group_id)) {
            $group_id = 0;
        }
    }
    $emT = explode('@', $email);
    //Verify domains --------------------------------------------------------------- 2008 10 05,P3
    $hash_domains_table = $ldap->hash_get_domains_ou($ou);
    if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) {
        writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
        writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
        $ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]);
    }
    //------------------------------------------------------------------------------
    $domains = $ldap->domains_get_locals_domains($ou);
    $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
    if ($ldap->ExistsDN($dn)) {
        writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
        echo $userid;
        exit;
    }
    $users = new user($userid);
    $users->mail = $email;
    $users->accountGroup = $group_id;
    $users->domainname = $_REQUEST["user_domain"];
    if ($password != null) {
        $users->password = $password;
    }
    $users->ou = $ou;
    if ($domains[$_REQUEST["user_domain"]] == true) {
        $upd = array();
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:domains.edit.user.php

示例4: CreateUser

function CreateUser()
{
    $ldap = new clladp();
    $tpl = new templates();
    $groupid = $ldap->GroupIDFromName($_GET["ou"], $_GET["group"]);
    $user = new user();
    $user->uid = $_GET["uid"];
    $user->ou = $_GET["ou"];
    $user->DisplayName = $_GET["uid"];
    $user->group_id = $groupid;
    $user->mail = "{$_GET["uid"]}@{$_GET["domain"]}";
    $user->password = $_GET["password"];
    if (!$user->add_user()) {
        echo $tpl->_ENGINE_parse_body("{$_GET["uid"]}@{$_GET["domain"]} {failed}");
    } else {
        echo $tpl->_ENGINE_parse_body("{$_GET["uid"]}@{$_GET["domain"]} {added}");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:18,代码来源:firstwizard.php


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