summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b83739a)
raw | patch | inline | side by side (parent: b83739a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 May 2008 11:51:12 +0000 (11:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 May 2008 11:51:12 +0000 (11:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10846 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/ogroups/class_ogroup.inc | patch | blob | history | |
gosa-core/plugins/admin/ogroups/generic.tpl | patch | blob | history | |
gosa-core/plugins/admin/ogroups/trust_machines.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index c7ad8490ca8f6f73c72a335af40631b0ea4fa221..f64b00ba592f75491e998b4320dbee70fea985a0 100644 (file)
var $group_dialog= FALSE;
var $view_logged = FALSE;
+ var $accessTo= array();
+ var $trustModel= "";
+ var $show_ws_dialog = FALSE;
+
+ var $was_trust_account= FALSE;
+
/* attribute list for save action */
- var $attributes= array("cn", "description", "gosaGroupObjects","member");
+ var $attributes= array("cn", "description", "gosaGroupObjects","member","accessTo","trustModel");
var $objectclasses= array("top", "gosaGroupOfNames");
function ogroup (&$config, $dn= NULL)
$this->base = session::get('CurrentMainBase');
} else {
$this->base= preg_replace("/^[^,]+,".normalizePreg(get_ou("ogroupou"))."/","",$this->dn);
+
+ /* Is this account a trustAccount? */
+ if ($this->is_account && isset($this->attrs['trustModel'])){
+ $this->trustModel= $this->attrs['trustModel'][0];
+ $this->was_trust_account= TRUE;
+ } else {
+ $this->was_trust_account= FALSE;
+ $this->trustModel= "";
+ }
+
+ $this->accessTo = array();
+ if ($this->is_account && isset($this->attrs['accessTo'])){
+ for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){
+ $tmp= $this->attrs['accessTo'][$i];
+ $this->accessTo[$tmp]= $tmp;
+ }
+ }
}
/* Load member data */
}
}
+ /***********
+ * Trusts
+ ***********/
+
+ /* Add user workstation? */
+ if (isset($_POST["add_ws"])){
+ $this->show_ws_dialog= TRUE;
+ $this->dialog= TRUE;
+ }
+
+ /* Add user workstation? */
+ if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
+ foreach($_POST['wslist'] as $ws){
+ $this->accessTo[$ws]= $ws;
+ }
+ ksort($this->accessTo);
+ $this->is_modified= TRUE;
+ }
+
+ /* Remove user workstations? */
+ if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
+ foreach($_POST['workstation_list'] as $name){
+ unset ($this->accessTo[$name]);
+ }
+ $this->is_modified= TRUE;
+ }
+
+ /* Add user workstation finished? */
+ if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
+ $this->show_ws_dialog= FALSE;
+ $this->dialog= FALSE;
+ }
+
+ /* Show ws dialog */
+ if ($this->show_ws_dialog){
+ /* Save data */
+ $sysfilter= session::get("sysfilter");
+ foreach( array("depselect", "regex") as $type){
+ if (isset($_POST[$type])){
+ $sysfilter[$type]= $_POST[$type];
+ }
+ }
+ if (isset($_GET['search'])){
+ $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+ if ($s == "**"){
+ $s= "*";
+ }
+ $sysfilter['regex']= $s;
+ }
+ session::set("sysfilter", $sysfilter);
+
+ /* Get workstation list */
+ $exclude= "";
+ foreach($this->accessTo as $ws){
+ $exclude.= "(cn=$ws)";
+ }
+ if ($exclude != ""){
+ $exclude= "(!(|$exclude))";
+ }
+ $regex= $sysfilter['regex'];
+ $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
+
+ $deps_a = array(get_ou("serverou"),
+ get_ou("terminalou"),
+ get_ou("workstationou"));
+ $res= get_sub_list($filter, array("terminal","server","workstation"), $deps_a, get_ou("systemsou").$sysfilter['depselect'],
+ array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
+ $wslist= array();
+ foreach ($res as $attrs){
+ $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
+ }
+ asort($wslist);
+ $smarty->assign("search_image", get_template_path('images/lists/search.png'));
+ $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
+ $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
+ $smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("alphabet", generate_alphabet());
+ foreach( array("depselect", "regex") as $type){
+ $smarty->assign("$type", $sysfilter[$type]);
+ }
+ $smarty->assign("hint", print_sizelimit_warning());
+ $smarty->assign("wslist", $wslist);
+ $smarty->assign("apply", apply_filter());
+ $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
+ return ($display);
+ }
+
+ /***********
+ * Ende - Trusts
+ ***********/
+
+
/* Dialog handling */
if(is_object($this->dialog) && $this->acl_is_moveable()){
/* Must be called before save_object */
$smarty->assign("$val", $this->$val);
}
+ /******
+ Trust account
+ ******/
+ $smarty->assign("trusthide", " disabled ");
+ $smarty->assign("trustmodeACL", $this->getacl("trustModel"));
+ if ($this->trustModel == "fullaccess"){
+ $trustmode= 1;
+ // pervent double disable tag in html code, this will disturb our clean w3c html
+ $smarty->assign("trustmode", $this->getacl("trustModel"));
+
+ } elseif ($this->trustModel == "byhost"){
+ $trustmode= 2;
+ $smarty->assign("trusthide", "");
+ } else {
+ // pervent double disable tag in html code, this will disturb our clean w3c html
+ $smarty->assign("trustmode", $this->getacl("trustModel"));
+ $trustmode= 0;
+ }
+ $smarty->assign("trustmode", $trustmode);
+ $smarty->assign("trustmodes", array( 0 => _("disabled"), 1 => _("full access"),
+ 2 => _("allow access to these hosts")));
+
+ $smarty->assign("workstations", $this->accessTo);
+
+ if((count($this->accessTo))==0){
+ $smarty->assign("emptyArrAccess",true);
+ }else{
+ $smarty->assign("emptyArrAccess",false);
+ }
+ /******
+ Ende - Trust account
+ ******/
+
return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
}
/* Save additional values for possible next step */
if (isset($_POST['ogroupedit'])){
+ /******
+ Trust account
+ ******/
+
+ if($this->acl_is_writeable("trustModel")){
+ if (isset($_POST['trustmode'])){
+ $saved= $this->trustModel;
+ if ($_POST['trustmode'] == "1"){
+ $this->trustModel= "fullaccess";
+ } elseif ($_POST['trustmode'] == "2"){
+ $this->trustModel= "byhost";
+ } else {
+ $this->trustModel= "";
+ }
+ if ($this->trustModel != $saved){
+ $this->is_modified= TRUE;
+ }
+ }
+ }
+ /******
+ Ende Trust account
+ ******/
+
/* Create a base backup and reset the
base directly after calling plugin::save_object();
Base will be set seperatly a few lines below */
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
}
+ /******
+ Trust accounts
+ ******/
+ $objectclasses= array();
+ foreach ($this->attrs['objectClass'] as $key => $class){
+ if (preg_match('/trustAccount/i', $class)){
+ continue;
+ }
+ $objectclasses[]= $this->attrs['objectClass'][$key];
+ }
+ $this->attrs['objectClass']= $objectclasses;
+ if ($this->trustModel != ""){
+ $this->attrs['objectClass'][]= "trustAccount";
+ $this->attrs['trustModel']= $this->trustModel;
+ $this->attrs['accessTo']= array();
+ if ($this->trustModel == "byhost"){
+ foreach ($this->accessTo as $host){
+ $this->attrs['accessTo'][]= $host;
+ }
+ }
+ } else {
+ if ($this->was_trust_account){
+ $this->attrs['accessTo']= array();
+ $this->attrs['trustModel']= array();
+ }
+ }
+
+ /******
+ Ende - Trust accounts
+ ******/
+
/* Write back to ldap */
$ldap->cd($this->dn);
$this->cleanup();
diff --git a/gosa-core/plugins/admin/ogroups/generic.tpl b/gosa-core/plugins/admin/ogroups/generic.tpl
index 19cb69cacf983878145dea3bd8617e9bbc9ffe02..7171ea72ec502da949e06713729c6692c9f55fc4 100644 (file)
</tr>
</table>
+
+
+<p class="seperator"> </p>
+
+ {t}Trust mode{/t}
+ {render acl=$trustmodeACL}
+ <select name="trustmode" id="trustmode" size=1
+ onChange="changeSelectState('trustmode', 'wslist');
+ changeSelectState('trustmode', 'add_ws');
+ changeSelectState('trustmode', 'del_ws');">
+ {html_options options=$trustmodes selected=$trustmode}
+ </select><br>
+ {/render}
+ {render acl=$trustmodeACL}
+ <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
+ {html_options values=$workstations output=$workstations}
+ {if $emptyArrAccess}
+ <option disabled> </option>
+ {/if}
+ </select>
+ {/render}
+ <br>
+ {render acl=$trustmodeACL}
+ <input type="submit" id="add_ws" value="{msgPool type=addButton}" name="add_ws" {$trusthide}>
+ {/render}
+ {render acl=$trustmodeACL}
+ <input type="submit" id="del_ws" value="{msgPool type=delButton}" name="delete_ws" {$trusthide}>
+ {/render}
+
+
</td>
<td style="border-left:1px solid #A0A0A0; padding-left:10px;">
<b><LABEL for="members">{t}Member objects{/t}</LABEL></b> ({$combinedObjects})
diff --git a/gosa-core/plugins/admin/ogroups/trust_machines.tpl b/gosa-core/plugins/admin/ogroups/trust_machines.tpl
--- /dev/null
@@ -0,0 +1,42 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+ <td style="vertical-align:top;">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px">
+ <b>{t}Select systems to add{/t} {$hint}</b><br>
+ </p>
+ </div>
+ <div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <select style="width:100%; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
+ {html_options values=$wslist output=$wslist}
+ </select>
+ </p>
+ </div>
+ </td>
+ <td style="vertical-align:top; width:350px">
+ <div class="contentboxh" style="height:20px;">
+ <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]"><b>{
+t}Filters{/t}</b></p>
+ </div>
+ <div class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+ <table summary="" style="width:100%;">
+ {$alphabet}
+ </table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle> {t}Display systems of department{/t}</td>
+ <td><select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+ {html_options options=$deplist selected=$depselect}
+ </select></td></tr></table>
+ <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$search_image}" align=middle> {t}Display systems matching{/t}</td>
+ <td><input type='text' name='regex' maxlength='20' value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
+ {$apply}
+ </div>
+ </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="add_ws_finish" value="{msgPool type=addButton}">
+
+ <input type=submit name="add_ws_cancel" value="{msgPool type=cancelButton}">
+</p>