summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b3b845)
raw | patch | inline | side by side (parent: 2b3b845)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Jan 2007 08:13:13 +0000 (08:13 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Jan 2007 08:13:13 +0000 (08:13 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5588 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/addons/notifications/class_msgplug.inc | patch | blob | history | |
plugins/addons/notifications/contents.tpl | patch | blob | history | |
plugins/addons/notifications/main.inc | patch | blob | history |
diff --git a/plugins/addons/notifications/class_msgplug.inc b/plugins/addons/notifications/class_msgplug.inc
index 08a2395680029baaef209a5ec5f82b6062666250..3aea28353e18fb666456ba00cad0533abe8c188d 100644 (file)
var $templates= array();
var $template= "";
var $finalized= false;
-
+ var $module = "msgplug";
function msgplug ($config, $dn= NULL)
{
$this->targets= array("user" => _("Users"), "group" => _("Groups"));
asort($this->targets);
- /* Users */
- $ldap= $config->get_ldap_link();
- $ldap->cd($config->current['BASE']);
- if ($tag == ""){
- $ldap->search('(objectClass=gosaAccount)', array('uid', 'cn'));
- } else {
- $ldap->search('(&(objectClass=gosaAccount)(gosaUnitTag='.$tag.'))', array('uid', 'cn'));
- }
- while ($attrs= $ldap->fetch()){
+ $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
+ foreach($res as $key => $attrs){
$this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
}
ksort($this->users);
+ print_a($this->users);
- /* Groups */
- $ldap->cd($config->current['BASE']);
- if ($tag == ""){
- $ldap->search('(objectClass=posixGroup)', array('cn', 'description'));
- } else {
- $ldap->search('(&(objectClass=posixGroup)(gosaUnitTag='.$tag.'))', array('cn', 'description'));
- }
- while ($attrs= $ldap->fetch()){
+ $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
+ foreach($res as $key => $attrs){
$dsc= "";
if (isset($attrs['description'][0])){
$dsc= $attrs['description'][0];
}
$this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
}
- ksort($this->groups);
+ ksort($this->users);
+
/* Load templates */
if (isset($this->config->current['NOTIFYDIR'])){
plugin::execute();
/* Send message? */
- if (isset($_POST['send'])){
+ if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
/* Do we have recipients? */
if (count($this->recipients)){
/*Permissions ok? */
- if (chkacl($this->acl, 'notify') != ""){
+ if (!$this->acl_is_writeable('notify')){
print_red(_("You have no permissions to send a message!"));
} else {
$cmd= search_config($this->config->data['MENU'], "msgplug", "NOTIFY_COMMAND");
}
/* Add to list? */
- if (isset($_POST['add']) && isset($_POST['source'])){
+ if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
foreach ($_POST['source'] as $key){
if ($this->target == 'user'){
$this->recipients[$key]= $this->users[$key];
$smarty->assign('recipients', $this->recipients);
/* Assign ACL */
- $smarty->assign('nmessageACL', chkacl($this->acl, "notify"));
+ $smarty->assign('nmessageACL', $this->getacl("notify"));
/* Handle templates */
$smarty->assign('show_templates', $this->show_templates?"true":"false");
return $desc;
}
+
+ function save_object()
+ {
+ plugin::save_object();
+ foreach($this->attributes as $attr){
+ if(isset($_POST[$attr])){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Notification"),
+ "plDescription" => _("Notification plugin"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 89,
+ "plSection" => array("addon"),
+ "plCategory" => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
+
+ "plProvidedAcls" => array(
+ "notify" => _("Allow sending notifications")
+ )
+ ));
+ }
+
}
index a7abd2cf49b541776609537b77ed74e8036d6da6..6898696137ae932404963383576364128c9f4b66 100644 (file)
<p class="seperator"> </p>
<h2>{t}Message{/t}</h2>
+{render acl=$nmessageACL}
+ <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
+{/render}
-<textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" {$nmessageACL}>{$nmessage}</textarea>
{if $show_templates eq "true"}
<select name="nmessage_template">
{html_options options=$message_templates selected=$template}
<p class="seperator"> </p>
<div style='text-align:right;margin-top:5px'>
+{render acl=$nmessageACL}
<input type="submit" name="send" value="{t}Send message{/t}">
+{/render}
</div>
index fe806b8b25dbf7d00925b511ed2b4cf0f02fca14..c73698541f92c3f830c54e70ba1024c932a0ff1b 100644 (file)
*/
if (!$remove_lock){
- /* Create message object on demand */
- if (!isset($_SESSION['msgplug']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
- $_SESSION['msgplug']= new msgplug ($config);
- }
+ /* Create msgplug object on demand */
+ if (!isset($_SESSION['msgplug']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $ui = get_userinfo();
+ $_SESSION['msgplug']= new msgplug ($config);
+ $_SESSION['msgplug']->set_acl_category("msgplug");
+
+ /* Check root dn and user dn for acl informations */
+ $_SESSION['msgplug']->set_acl_base($config->current['BASE']);
+ if($_SESSION['msgplug']->getacl("") == ""){
+ $_SESSION['msgplug']->set_acl_base($ui->dn);
+ }
+ }
$msgplug= $_SESSION['msgplug'];
- /* Set permissions */
- $acl= get_permissions ($ui->dn, $ui->subtreeACL);
- $msgplug->acl= get_module_permission($acl, "msgplug", $ui->dn);
-
/* save changes back to object */
if (isset ($_POST['target'])){
$msgplug->save_object ();