summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e115096)
raw | patch | inline | side by side (parent: e115096)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 8 Apr 2008 07:21:21 +0000 (07:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 8 Apr 2008 07:21:21 +0000 (07:21 +0000) |
-Allow to create a default entry
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10267 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10267 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc
index fa135f12031adc3c1ba9abfbccf85aeac2c23a2c..d0de10f6fd079ad15d44337566d5746c5e623003 100644 (file)
/* Append create options */
if(preg_match("/c/",$acl)) {
$s.= "...|<input class='center' type='image' src='images/list_new_sudo.png' alt=''> "._("Role")."|new_role|\n";
+ $s.= "...|<input class='center' type='image' src='images/list_new_sudo.png' alt=''> "._("Default")."|new_default|\n";
}
/* Append multiple remove */
diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc
index 7af22e569453f9572b2cfd7d5dc95c457bb8c2de..ffccd2576e83f8bb7c777795d3b4b87fdabeeafb 100644 (file)
var $sudoHost = array("ALL");
var $sudoRunAs = array("ALL");
- var $accessTo = array();
- var $trustModel = "";
- var $show_ws_dialog = FALSE;
+ var $accessTo = array();
+ var $trustModel = "";
+ var $show_ws_dialog = FALSE;
+ var $was_trust_account= FALSE;
var $objectclasses = array("top","sudoRole");
var $attributes = array("cn","description","sudoUser","sudoCommand","sudoHost","sudoRunAs","accessTo","trustModel");
function save_object()
{
plugin::save_object();
+
+ if($this->is_default){
+ $this->cn = "default";
+ }
if(is_object($this->dialog)){
$this->dialog->save_object();
$message[] = msgPool::required(_("Name"));
}
+ /* Check if name is reserved */
+ if(!$this->is_default && preg_match("/^default$/i",$this->cn)){
+ $message[] = msgPool::reserved(_("Name"));
+ }
+
/* Check name */
if(!preg_match("/^[a-z]*$/i",$this->cn)){
$message[] = msgPool::invalid(_("Name"),$this->cn,"/[a-z]/i");
}
+ public function set_default($state)
+ {
+ $this->is_default = TRUE;
+ $this->cn = "default";
+ }
+
+
/*! \brief Add ACL object
@return Returns the ACL object.
*/
diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc b/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc
index 47fd657a70b349c030866375670d5c6183d0d860..9571c7ed0ecfeeab59c4e3c098d0fc5140899f20 100644 (file)
}
}
- if(isset($_POST['menu_action']) && in_array($_POST['menu_action'],array("new_role","del_role"))){
+ if(isset($_POST['menu_action']) && in_array($_POST['menu_action'],array("new_role","del_role","new_default"))){
$s_action = $_POST['menu_action'];
}
********************/
/* New sudo? */
- if ($s_action=="new_role"){
+ if ($s_action=="new_role" || $s_action == "new_default"){
/* Check create permissions */
$acl = $this->ui->get_permissions($this->base,"sudo/sudo");
/* Set up the sudo ACL's for this 'dn' */
$this->sudotabs->set_acl_base($this->base);
+
+ /* This entry will become the default entry */
+ if($s_action == "new_default"){
+ $this->sudotabs->set_default(TRUE);
+ }
}
}
index d437576122d7120c5a5b7c827921cd824f80e7a0..7fda69f487874e3db6f2b2fb2a83045a5e81bd6b 100644 (file)
{t}Name{/t}
</td>
<td>
- {render acl=$cnACL}
- <input type="text" name="cn" value="{$cn}">
- {/render}
+ <input type="text" name="dummy" value="{$cn}" disabled>
</td>
</tr>
<tr>
diff --git a/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc b/gosa-plugins/sudo/admin/sudo/tabs_sudo.inc
index 0e0c1267c6e8a7e16497419ad3bacc44b3e80d15..666fb4c71f06f24ab0fccb1057a22c0890b70764 100644 (file)
$this->addSpecialTabs();
}
+ function set_default($state)
+ {
+ if(isset($this->by_object['sudo'])){
+ $this->by_object['sudo']->set_default($state);
+ }
+ }
+
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['sudo'];