<?php
/*
This file is part of Thomas Bley's moregroupware webmail2/calendar2/admin2 module. (tb-mgw)

More information:
-----------------

Simple Groupware Solutions Thomas Bley
Fichtenstr. 23
Germany, 85640 Putzbrunn

Contact:
--------

info@simple-groupware.de

http://www.simple-groupware.de


Copyright 2002-2003 Thomas Bley
tb-mgw is distributed under the terms of the GNU General Public License 

tb-mgw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

tb-mgw is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with tb-mgw; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

// Rights-inc
// Moregroupware.org

$valid_user_nodes = array(
  "personalcalendars_".get_calendar_id($_SESSION["MGW"]->username)
);

$cals_users = array();
$cals_groups = array();
$cals_others = array();
$cals_holidays = array();

$sql = "SELECT id,dcalendar FROM mgw_calendar2_cals order by dcalendar";
if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
while($row = $res->FetchRow()) {
  if ($row["dcalendar"]!="") {
    if (is_numeric($row["dcalendar"])) {
	  $cals_groups[$row["id"]] = "";
	} elseif ($row["dcalendar"][0]=="#") {
	  $cals_holidays[$row["id"]] = "";
	} elseif ($row["dcalendar"][0]=="@") {
	  $cals_others[$row["id"]] = "";
	} else {
	  $cals_users[$row["id"]] = "";
	}
  }
}


$calendar_rights = array("read"=>0,"create"=>0,"modify"=>0,"delete"=>0);
$calendar_rights_personal = array("read"=>0,"create"=>0,"modify"=>0,"delete"=>0,"viewprivate"=>0,"viewconfidential"=>0);

$rights = array("personalcalendars"=>$cals_users,
				"groupcalendars"=>$cals_groups,
				"publiccalendars"=>$cals_others,
				"holidaycalendars"=>$cals_holidays
				);
				
foreach ($rights["personalcalendars"] as $key=>$key2) {
  $rights["personalcalendars"][$key] = $calendar_rights_personal;
}
foreach ($rights["groupcalendars"] as $key=>$key2) {
  $rights["groupcalendars"][$key] = $calendar_rights;
}
foreach ($rights["publiccalendars"] as $key=>$key2) {
  $rights["publiccalendars"][$key] = $calendar_rights;
}
foreach ($rights["holidaycalendars"] as $key=>$key2) {
  $rights["holidaycalendars"][$key] = $calendar_rights;
}

$rights["calendarmanager"] = array("listcalendars"=>0, "createcalendars"=>0, "modifycalendars"=>0, "deletecalendars"=>0);

$rights["accessmodule"] = 0;

?>
