/usr/share/gosa/plugins/admin/systems/goto/class_SelectDeviceType.inc is in gosa-plugin-goto 2.7.4+reloaded2-1+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | <?php
class SelectDeviceType extends plugin
{
/* attribute list for save action */
var $ignore_account= TRUE;
var $attributes= array("ObjectGroup","SystemType");
var $objectclasses= array("whatever");
var $ObjectGroups = array();
var $SystemTypes = array();
var $ObjectGroup = "none";
var $SystemType = "gotoWorkstation";
var $dn;
function SelectDeviceType (&$config, $dn= NULL)
{
if(!is_array($dn)){
$this->dns = array($dn);
}else{
$this->dns = $dn;
}
plugin::plugin ($config, NULL);
/* Get object groups */
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->config->current['BASE']);
$ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
$tmp= array();
while($attrs = $ldap->fetch()){
$tmp[$attrs['dn']]= $attrs['cn'][0];
}
asort($tmp, SORT_LOCALE_STRING);
$this->ObjectGroups= $tmp;
$this->SystemTypes =array("gotoWorkstation"=>_("Workstation"), "gotoTerminal"=>_("Terminal"), "goServer"=>_("Server"));
if(class_available("opsi")){
$this->SystemTypes["FAKE_OC_OpsiHost"]= _("Windows workstation");
}
}
function execute()
{
/* Call parent execute */
plugin::execute();
/* Get object groups */
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->config->current['BASE']);
$ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("gosaGroupObjects","cn"));
$tmp= array("W" => array(),"T" => array(), "S" => array(),"O" => array());
while($attrs = $ldap->fetch()){
$tmp[preg_replace("/[\[\] ]/","",$attrs['gosaGroupObjects'][0])][$attrs['dn']] = $attrs['cn'][0];
}
/* Fill templating stuff */
$smarty= get_smarty();
$display= "";
$map = array("gotoWorkstation" => "W","gotoTerminal" => "T","goServer" => "S", "FAKE_OC_OpsiHost" => "O");
$smarty->assign("dns_cnt" , set_post(count($this->dns)));
$smarty->assign("ogroups", set_post($tmp[$map[$this->SystemType]]));
$smarty->assign("SystemTypes" ,set_post($this->SystemTypes));
$smarty->assign("SystemTypeKeys" ,set_post(array_flip($this->SystemTypes)));
$smarty->assign("ObjectGroup", set_post($this->ObjectGroup));
$smarty->assign("SystemType", set_post($this->SystemType));
$display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE,dirname(__FILE__)));
return($display);
}
/* Save data to object */
function save_object()
{
plugin::save_object();
foreach($this->attributes as $attr){
if(isset($_POST[$attr])){
$this->$attr = get_post($attr);
}
}
}
/* Check supplied data */
function check()
{
/* Call common method to give check the hook */
$message= plugin::check();
return ($message);
}
/* Save to LDAP */
function save()
{
}
function acl_is_writeable($attribute,$skip_write = FALSE)
{
if($this->read_only) return(FALSE);
$ui= get_userinfo();
return preg_match('/w/', $ui->get_permissions($this->acl_base, $this->acl_category."systemManagement", "", $skip_write));
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
|