partage calendrier sunbird : accès selon mot de pass[résol

Vous pouvez discuter dans cette catégorie des logiciels et extensions tiers créés à partir des technologies Mozilla.
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

Merci Pat pour tes explications.
Il est vrai que j'avais regardé l'utilisation d'Icalx mais, comme tu le dis, pour des raisons de confidentialité, je ne peux rester qu'en intranet.
Je fais partie d'un cabinet comptable et, de ce fait, certaines données sont sensibles ...
Encore merci d'avoir pris le temps de m'aider.

pom'
PatLogan
Gecko
Messages : 81
Inscription : 12 mai 2004, 11:53

Message par PatLogan »

effectivement, dans ce cas, jettes aussi un oeil du coté d'axentra.net, c'est en https, ça peut t'intéresser...

sauf si ton pb est résolu...

++

Pat
penpen
Gecko
Messages : 64
Inscription : 05 janv. 2005, 12:45

Message par penpen »

Le fait de ne pas cocher la case, n'empèche en rien un utilisateur de ne pas la cocher... Apres questions de responsabilités, mais ...

Sinon je pense que la manipulation n'est pas très compliquée, suffit d'avoir un peu de patience, et de ne pas hésiter à ce documenter.
Tack så micket
PatLogan
Gecko
Messages : 81
Inscription : 12 mai 2004, 11:53

Message par PatLogan »

oui, j'y ai réfléchi à nouveau et effectivement, à part un intranet avec gestion des droits en écriture au niveau du serveur, je ne vois pas bien ce qu'on peut faire avec un truc plus simple tout en préservant la confidentialité des données...

++

Pat
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

Bonjour tout le monde,

Quelle belle journée, hein ?!?
Un soleil radieux, les zoziaux qui gazouillent et ... ENFIN ... j'y suis arrivé !!! 8) Merci, merci ...

Mais (il y a toujours un mais) je n'ai pu mettre le mot de passe qu'en clair dans le fichier utilisateurs, du style :
pom:pepin

tant pis ... c'est déjà mieux que rien !!!

Les zoziaux font trop de bruit ...
Maintenant que je suis 'logué', je peux voir les calendriers publics, mais pas les privés pour lesquels je devrais avoir accès !!!

put..ns d'oiseaux, ils me filent mal à la tête !!!
j'en ai marre !!!
et je suis bloqué avec sunbird, qui ne parvient pas à récupérer l'agenda !!!
Je vais faire une battue ...
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

je sais que je suis suuuuuper novice et que je pose beaucoup de questions, mais j'ai vraiment besoin de votre aide svp.
les agendas dans le $locked_cals ne sont pas visibles, hormis le premier !!!
voici ce que donne mon config.inc.php :

Code : Tout sélectionner

$locked_cals[] = 'clio';	
$locked_cals[] = 'agenda2';
$locked_cals[] = 'david';
$locked_cals[] = '';

$apache_map['test'] = array('clio', 'agenda2');
$apache_map['user2'] = array('');
$apache_map['user3'] = array('');
$apache_map['user4'] = array('');	
Si je rentre avec l'user 'test', je ne vois que l'agenda 'clio'

J'ai vraiment besoin de votre aide. Si vous avez le temps (et la patience) :roll:
penpen
Gecko
Messages : 64
Inscription : 05 janv. 2005, 12:45

Message par penpen »

J'ai fais le test et contrairement à ce que je disais, quelques réponses plus haut, il faut paramétrer $allow_login à yes dans le fichier config.inc.php

Code : Tout sélectionner

$allow_login = 'yes';
J'espère que c'est bien ca pour ton cas...
Patience, on touche au but.
Tack så micket
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

Yyyeeeeesssssssss !!!!!!

Un grand, que dis-je, un énorme, un inconmensurable merci pour ton aide :wink:
Ce coup-ci, ça y est, ça marche !!!
Je ne sais comment te remercier, sincèrement tu m'as vraiment sorti de la panade comme on dit chez moi.
Tack så micket

Ca y est, je peux enfin mettre [Résolu] in the sujet :D
Encore merci,
Excellente journée,
@ bientôt peut-être mais avec moins de questions :wink:

Pom'
penpen
Gecko
Messages : 64
Inscription : 05 janv. 2005, 12:45

Message par penpen »

Je crois que je peux te proposer quelque chose pour faire cohabiter le triplet calendriers vérrouillés, authentification apache et sunbird.
Si tu veux bien tester je le publie.
Tack så micket
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

avec grand plaisir :wink:
je posterai les résultats, comme ça si quelqu'un veut faire pareil, il aura les réponses.
penpen
Gecko
Messages : 64
Inscription : 05 janv. 2005, 12:45

Message par penpen »

Voila le script mis à jour pour l'authentification apache et les calendrier vérouillés. Je l'ai mis aussi en téléchargement ICI.

L'url pour s'abonner au calendrier est du type: http://monsite/.../calendars/publish.mo ... ndrier.ics

Code : Tout sélectionner

<?php

/*
Extension to PHP iCalendar for supporting publishing from Apple iCal
Date: 11.12.2003
Author: Dietrich Ayala
Copyright 2003 Dietrich Ayala

Description:
This allows iCal to publish to your PHP iCalendar site *without* WebDAV support.
This helps with commercial hosts where WebDAV is not available.

Features:
- supports publishing and deleting calendars
- does not require WebDAV

Installation:
1. place this file in your PHP iCalendar calendars directory (or anywhere else)
2. configure path to PHP iCalendar config file (below)
3. make sure that PHP has write access to the calendars directory (or whatever you set $calendar_path to)
4. set up directory security on your calendars directory
5. turn on publishing in your PHP iCalendar config file by setting $phpicalendar_publishing to 1.

Usage (Apple iCal):
1. Open iCal, select a calendar for publishing
2. Select "Publish" from the "Calendar" menu
3. Configure to your liking, and set the URL to (eg): http://localhost/~dietricha/calendar/calendars/publish.php
4. Click the "Publish" button

Usage (Mozilla Calendar):
1. Your version of php and apache MUST support $_SERVER['PATH_INFO']
2. You must have supplied a username and password in your config.php
2. Create your calendar in Mozilla
3. Add something to it (it must not be empty)
4. Manually upload it to your calendars directory.
5. Make sure that the webserver can write to the calendar file.
(Mozilla will not save to the remote location without first downloading a copy
from the remote location)
6. Edit your calendar setup in mozilla
Location http://example.com/path/to/publish.php/calendarname.ics
calendarname.ics should be a unique filename and must end with .ics
7. Username (username from config.php)
8. Password (password from config.php)
9. Check "publish changes automatically"

Security:
The calendars directory should be configured to require authentication. This can be done via any methods
supported by your webserver. There is much documentation available on the web for doing per-directory
authentication for Apache. This protects any private calendar data, and prevents unauthorized users
from updating or deleting your calendar data.
There's also code below that forwards any GET requests to the PHP iCalendar front page.

Troubleshooting:
You can turn on logging by setting the PHPICALENDAR_LOG_PUBLISHING constant to 1 below.
This will write out a log file to the same directory as this script.
Don't forget to turn off logging when done!!

*/

// include PHP iCalendar configuration variables
include('../config.inc.php');

// set calendar path, or just use current directory
$calendar_path = (isset($calendar_path) && $calendar_path != '') ? $calendar_path : '';

// allow/disallow publishing

$phpicalendar_publishing = isset($phpicalendar_publishing) ? $phpicalendar_publishing : 0;
define('PHPICALENDAR_PUBLISHING', $phpicalendar_publishing );

// toggle logging
define('PHPICALENDAR_LOG_PUBLISHING', 0 );

/* force GET requests to main calendar view
if($_SERVER['REQUEST_METHOD'] == 'GET')
{
header('Location: '.$default_path);
return;
}
*/
if (!isset($_SERVER['PHP_AUTH_USER'])) {
    header('WWW-Authenticate: Basic realm="Calendar"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'You must be authorized!';
    exit;
} else {
    logmsg("connection:  ".$_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']);

    preg_match("/\/([ A-Za-z0-9.]*).ics/i",$_SERVER['PATH_INFO'],$matches);
    $calendar_name = $matches[1];
    logmsg("requested calendar: ".$calendar_name);

    // check if it is a locked calendar, then check $apache_map
    if (in_array($calendar_name, $locked_cals)) {
        logmsg("requested access to locked $calendar_name calendar");

        if(array_key_exists($_SERVER['PHP_AUTH_USER'], $apache_map)) {
            if ($apache_map[$_SERVER['PHP_AUTH_USER']] != array('') &&
                in_array($calendar_name, $apache_map[$_SERVER['PHP_AUTH_USER']]))
            {
                logmsg($_SERVER['PHP_AUTH_USER']." has access granted to $calendar_name");
            } else {
                header('HTTP/1.0 401 Unauthorized');
                echo 'You must be authorized!';
                exit;
            }
        } else {
            header('HTTP/1.0 401 Unauthorized');
            echo 'You must be authorized!';
            exit;
        }

    // otherwise check $auth_internal
    } else if ($_SERVER['PHP_AUTH_USER'] != $auth_internal_username || $_SERVER['PHP_AUTH_PW'] != $auth_internal_password) {
        header('WWW-Authenticate: Basic realm="Calendar"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'You must be authorized!';
        exit;
    }

    // only allow publishing if explicitly enabled
    if (PHPICALENDAR_PUBLISHING == 1) {

        logmsg("requested method: ".$_SERVER['REQUEST_METHOD']);

        // unpublishing
        if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
            // get calendar filename
            $calendar_file = $calendar_path.substr($_SERVER['REQUEST_URI'] , ( strrpos($_SERVER['REQUEST_URI'], '/') + 1) ) ;
            logmsg('received request to delete '.$calendar_file);
            // remove calendar file
            if (!unlink($calendar_file)) {
                logmsg('unable to delete the calendar file');
            } else {
                logmsg('deleted');
            }
            return;
        }

        // publishing
        if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
            // get calendar data
            if ($fp = fopen('php://input','r')) {
                while (!@feof($fp)) {
                    $data .= fgets($fp,4096);
                }

                @fclose($fp);
            } else {
                logmsg('unable to read input data');
            }
            if (isset($data)) {
                // get calendar name
                $cal_arr = explode("\n",$data);

                foreach($cal_arr as $k => $v) {
                    if (strstr($v,'X-WR-CALNAME:')) {
                        $arr = explode(':',$v);
                        $calendar_name = trim($arr[1]);
                        break;
                    }
                }

                $calendar_name = isset($calendar_name) ? $calendar_name : 'default';

                if (isset($_SERVER['PATH_INFO'])) {
                    preg_match("/\/([ A-Za-z0-9.]*).ics/i",$_SERVER['PATH_INFO'],$matches);
                    $calendar_name = $matches[1];
                }

                // write to file
                if ($fp = fopen($calendar_path.$calendar_name.'.ics','w+')) {
                    fputs($fp, $data, strlen($data) );
                    @fclose($fp);
                } else {
                    logmsg('couldnt open file '.$calendar_path.$calendar_name.'.ics' );
                }
            }
        }

        if ($_SERVER['REQUEST_METHOD'] == 'GET') {
            if (isset($_SERVER['PATH_INFO'])) {
                preg_match("/\/([ A-Za-z0-9._]*).ics/i",$_SERVER['PATH_INFO'],$matches);
                $icsfile = $matches[1];
                // get calendar data
                if (file_exists($calendar_path . $icsfile . '.ics') &&
                    is_readable($calendar_path . $icsfile . '.ics') &&
                    is_file($calendar_path . $icsfile . '.ics'))
                {
                    echo file_get_contents($calendar_path . $icsfile . '.ics');
                } else {
                    logmsg("file ".$icsfile.".ics doesnt exists");
                }
            } else {
                logmsg("variable PATH_INFO is not set");
            }
        }

    }
}

// for logging
function logmsg($str)
{
    if (defined('PHPICALENDAR_LOG_PUBLISHING') &&
    PHPICALENDAR_LOG_PUBLISHING == 1) {
        if ($fp = fopen('publish_log.txt','a+')) {
            $str = date("d/m - H:i ").$str."\n";
            fputs($fp, $str, strlen($str) );
            fclose($fp);
        }
    }
}
?>
Voilà, les retour d'expériences sont les bienvenus.[/url]
Tack så micket
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

Déjà un premier retour :wink:
L'url pour s'abonner au calendrier est du type:
http://monsite/.../calendars/publish.mo ... ndrier.ics
c'est bien "...apache.php?Moncalendrier.ics" non ?!?
l'importation des calendriers m'est refusée dans sunbird :
Echec de l'importation du fichier agenda.
Code erreur : 401 : Authorization Required
En revanche, la visu via le navigateur fonctionne toujours sans problème.

Y-a-t-il une modif à faire dans config.inc.php ?

Edit :
Bon, ben je peux m'acheter une corde et me pendre :roll:
c'est bien "...apache.php/Moncalendrier.ics"
et ça marche nickel :D
merci encore et toutes mes excuses ...
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

si, dans sunbird, l'utilisateur souscrit à un agenda auquel il n'a pas droit avec comme url http://mon_site/.../calendars/calendrier.ics il peut recevoir l'agenda et le visualiser.
penpen
Gecko
Messages : 64
Inscription : 05 janv. 2005, 12:45

Message par penpen »

ah ? mince alors...
Avec l'url http://../calendars/calendrier.ics ? donc sans utiliser un scripts de publication ?
Tack så micket
pom'
Salamandre
Messages : 38
Inscription : 12 mai 2005, 14:30

Message par pom' »

yes ...
comme je te le disais, il ne peut que le consulter, pas le modifier sur le serveur.
Répondre

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 4 invités