summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c2642b3)
raw | patch | inline | side by side (parent: c2642b3)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Apr 2010 09:27:28 +0000 (09:27 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Apr 2010 09:27:28 +0000 (09:27 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17495 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/groups/class_group.inc | patch | blob | history |
diff --git a/gosa-core/plugins/admin/groups/class_group.inc b/gosa-core/plugins/admin/groups/class_group.inc
index 72eec6a9ee6eb08cbcb0e50737aa6315739db931..4de8771ddde84f4abc1e5056faa68b45ded9f33a 100644 (file)
var $allowGroupsWithSameNameInOtherSubtrees = true;
var $baseSelector;
- /* Trustmodel/AccessTo
- */
- var $accessTo= array();
- var $trustModel= "";
- var $trustSelect = FALSE;
-
/* attribute list for save action */
- var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID","accessTo","trustModel");
+ var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
var $objectclasses= array("top", "posixGroup");
var $CopyPasteVars = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
plugin::plugin ($config, $dn);
+ $this->trustModeDialog = new trustModeDialog($this->config, $this->dn,NULL);
+ $this->trustModeDialog->setAcl('groups/group');
+
/* Load attributes depending on the samba version */
$this->orig_dn= $dn;
$this->orig_cn= $this->cn;
}
$this->orig_base = $this->base;
- /* Is this account a trustAccount? */
- if (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 (isset($this->attrs['accessTo'])){
- for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){
- $tmp= $this->attrs['accessTo'][$i];
- $this->accessTo[$tmp]= $tmp;
- }
- }
-
/* Get global filter config */
if (!session::is_set("sysfilter")){
$ui= get_userinfo();
}
}
+ $smarty= get_smarty();
- /* Add user workstation? */
- if (isset($_POST["add_ws"])){
- $this->trustSelect= new trustSelect($this->config,get_userinfo());
- $this->dialog= TRUE;
- }
-
- // Add selected machines to trusted ones.
- if (isset($_POST["add_ws_finish"]) && $this->trustSelect){
- $trusts = $this->trustSelect->detectPostActions();
- if(isset($trusts['targets'])){
-
- $headpage = $this->trustSelect->getHeadpage();
- foreach($trusts['targets'] as $id){
- $attrs = $headpage->getEntry($id);
- $this->accessTo[$attrs['cn'][0]]= $attrs['cn'][0];
- }
- ksort($this->accessTo);
- $this->is_modified= TRUE;
- }
- $this->trustSelect= NULL;
- $this->dialog= FALSE;
- }
-
-
- /* 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_cancel"])){
- $this->trustSelect= NULL;
- $this->dialog= FALSE;
- }
-
+ // Handle trust mode dialog
+ $trustModeDialog = $this->trustModeDialog->execute();
+ if($this->trustModeDialog->trustSelect){
+ $this->dialog = TRUE;
+ return($trustModeDialog);
- /* Show ws dialog */
- if ($this->trustSelect){
-
- // Build up blocklist
- session::set('filterBlacklist', array('cn' => array_values($this->accessTo)));
- return($this->trustSelect->execute());
}
+ $this->dialog = FALSE;
+ $smarty->assign("trustModeDialog" , $trustModeDialog);
- $smarty= get_smarty();
$smarty->assign("usePrototype", "true");
if($this->config->search("nagiosaccount", "CLASS",array('menu'))){
/* Members and users */
$smarty->assign("members", $this->members);
- /* Work on trust modes */
- $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")));
-
- if((count($this->accessTo))==0){
- $smarty->assign("emptyArrAccess",true);
- } else{
- $smarty->assign("emptyArrAccess",false);
-
- }
-
- $smarty->assign("workstations", $this->accessTo);
-
-
-
/* Checkboxes */
foreach (array("force_gid", "smbgroup") as $val){
if ($this->$val == "1"){
$smarty->assign("use_".$val,FALSE);
}
}
- foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group","trustmode") as $val){
+ foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group") as $val){
if(in_array($val,$this->multi_boxes)){
$smarty->assign("use_".$val,TRUE);
}else{
Base will be set seperatly a few lines below */
$base_tmp = $this->base;
plugin::save_object();
+ $this->trustModeDialog->save_object();
$this->base = $base_tmp;
/* Refresh base */
}
}
}
-
- /* Trust mode - special handling */
- 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;
- }
- }
- }
-
}
plugin::save();
- /* 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();
- }
- }
-
-
-
/* Remove objectClass for samba/phone support */
$tmp= array();
for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
}
+ $this->trustModeDialog->dn = $this->dn;
+ $this->trustModeDialog->save();
/* Check generated gidNumber, it may be used by another group.
*/
"sambaGroupType" => _("Samba group type"),
"sambaDomainName" => _("Samba domain name"),
- "trustModel" => _("System trust"),
+ "accessTo" => _("System trust"),
"fonGroup" => _("Phone pickup group"),
"nagiosGroup" => _("Nagios group"),
$base_tmp = $this->base;
plugin::multiple_save_object();
plugin::save_object();
+ $this->trustModeDialog->multiple_save_object();
$this->base = $base_tmp;
- foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group","trustmode") as $attr){
+ foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group") as $attr){
if(isset($_POST['use_'.$attr])){
$this->multi_boxes[] = $attr;
}
$this->groupType= $_POST['groupType'];
}
- /* Trust mode - special handling */
- 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;
- }
- }
- }
-
/* Save fon attribute */
if ($this->acl_is_writeable("fonGroup")){
if (isset ($_POST['fon_group'])){
function get_multi_edit_values()
{
$ret = plugin::get_multi_edit_values();
+ $ret = array_merge($ret,$this->trustModeDialog->get_multi_edit_values());
foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group") as $attr){
if(in_array($attr,$this->multi_boxes)){
}
}
- if(in_array("trustmode",$this->multi_boxes)){
- $ret['trustModel'] = $this->trustModel;
- $ret['accessTo'] = $this->accessTo;
- }
-
$ret['memberUid'] = $this->memberUid;
$ret['memberUid_used_by_some'] = $this->memberUid_used_by_some;
return($ret);
function init_multiple_support($attrs,$all)
{
plugin::init_multiple_support($attrs,$all);
+ $this->trustModeDialog->init_multiple_support($attrs,$all);
$this->memberUid = array();
$this->memberUid_used_by_some = array();
$this->memberUid[] = $source['memberUid'][$i];
}
}
- $this->accessTo = array();
- if (isset($source['accessTo'])){
- for ($i= 0; $i<$source['accessTo']['count']; $i++){
- $tmp= $source['accessTo'][$i];
- $this->accessTo[$tmp]= $tmp;
- }
- }
+ }
+
+
+ function set_acl_base($base)
+ {
+ plugin::set_acl_base($base);
+ $this->trustModeDialog->set_acl_base($base);
+ }
+
+
+ /*! \brief Enables multiple support for this plugin
+ */
+ function enable_multiple_support()
+ {
+ plugin::enable_multiple_support();
+ $this->trustModeDialog->enable_multiple_support();
}
$users[$uid] = $uid;
}
plugin::set_multi_edit_values($attrs);
+ $this->trustModeDialog->set_multi_edit_values($attrs);
$this->memberUid = $users;
}