-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
view_rights_room.php
132 lines (132 loc) · 5.27 KB
/
view_rights_room.php
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* view_rights_room.php
* Liste des privilèges d'une ressource
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2017-12-16 14:00$
* @author Laurent Delineau & JeromeB
* @copyright Copyright 2003-2020 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
*
* This file is part of GRR.
*
* GRR 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.
*/
include "personnalisation/connect.inc.php";
include "include/config.inc.php";
include "include/functions.inc.php";
include "include/$dbsys.inc.php";
include_once('include/misc.inc.php');
include "include/mrbs_sql.inc.php";
$grr_script_name = "view_rights_room.php";
// Settings
require_once("./include/settings.class.php");
//Chargement des valeurs de la table settingS
if (!Settings::load())
die("Erreur chargement settings");
// Session related functions
require_once("./include/session.inc.php");
// Resume session
include "include/resume_session.php";
// Paramètres langage
include "include/language.inc.php";
if ((Settings::get("authentification_obli") == 0) && (getUserName() == ''))
$type_session = "no_session";
else
$type_session = "with_session";
$id_room = isset($_GET["id_room"]) ? $_GET["id_room"] : NULL;
if (isset($id_room))
settype($id_room,"integer");
if ((authGetUserLevel(getUserName(),$id_room) < 4) || (!verif_acces_ressource(getUserName(), $id_room)))
{
showAccessDenied('');
exit();
}
echo begin_page(Settings::get("company").get_vocab("deux_points").get_vocab("mrbs"));
$res = grr_sql_query("SELECT * FROM ".TABLE_PREFIX."_room WHERE id=$id_room");
if (!$res)
fatal_error(0, get_vocab('error_room') . $id_room . get_vocab('not_found'));
$row = grr_sql_row_keyed($res, 0);
grr_sql_free($res);
echo '<h3 style="text-align:center;">';
echo get_vocab("room").get_vocab("deux_points")." ".htmlspecialchars($row["room_name"]);
$id_area = mrbsGetRoomArea($id_room);
$area_name = grr_sql_query1("SELECT area_name FROM ".TABLE_PREFIX."_area WHERE id='".$id_area."'");
$area_access = grr_sql_query1("SELECT access FROM ".TABLE_PREFIX."_area WHERE id='".$id_area."'");
echo "<br />(".$area_name;
if ($area_access == 'r')
echo " - <span class=\"avertissement\">".get_vocab("access")."</span>";
echo ")";
echo "</h3>";
// On affiche pour les administrateurs les utilisateurs ayant des privilèges sur cette ressource
echo "\n<h2>".get_vocab('utilisateurs_ayant_privileges')."</h2>";
$a_privileges = 'n';
// on teste si des utilateurs administre le domaine
$req_admin = "SELECT u.login, u.nom, u.prenom FROM ".TABLE_PREFIX."_utilisateurs u left join ".TABLE_PREFIX."_j_useradmin_area j on u.login=j.login WHERE j.id_area = '".$id_area."' order by u.nom, u.prenom";
$res_admin = grr_sql_query($req_admin);
$is_admin = '';
if ($res_admin)
{
for ($j = 0; ($row_admin = grr_sql_row($res_admin, $j)); $j++)
$is_admin .= $row_admin[1]." ".$row_admin[2]." (".$row_admin[0].")<br />";
}
if ($is_admin != '')
{
$a_privileges = 'y';
echo "\n<h3><b>".get_vocab("utilisateurs_administrateurs")."</b></h3>";
echo "<p>".$is_admin."</p>";
}
// On teste si des utilisateurs administrent la ressource
$req_room = "SELECT u.login, u.nom, u.prenom FROM ".TABLE_PREFIX."_utilisateurs u left join ".TABLE_PREFIX."_j_user_room j on u.login=j.login WHERE j.id_room = '".$id_room."' order by u.nom, u.prenom";
$res_room = grr_sql_query($req_room);
$is_gestionnaire = '';
if ($res_room)
{
for ($j = 0; ($row_room = grr_sql_row($res_room, $j)); $j++)
$is_gestionnaire .= $row_room[1]." ".$row_room[2]." (".$row_room[0].")<br />";
}
if ($is_gestionnaire != '')
{
$a_privileges = 'y';
echo "\n<h3><b>".get_vocab("utilisateurs_gestionnaires_ressource")."</b></h3>";
echo "<p>".$is_gestionnaire."</p>";
}
// On teste si des utilisateurs reçoivent des mails automatiques
$req_mail = "SELECT u.login, u.nom, u.prenom FROM ".TABLE_PREFIX."_utilisateurs u left join ".TABLE_PREFIX."_j_mailuser_room j on u.login=j.login WHERE j.id_room = '".$id_room."' order by u.nom, u.prenom";
$res_mail = grr_sql_query($req_mail);
$is_mail = '';
if ($res_mail)
{
for ($j = 0; ($row_mail = grr_sql_row($res_mail, $j)); $j++)
$is_mail .= $row_mail[1]." ".$row_mail[2]." (".$row_mail[0].")<br />";
}
if ($is_mail != '')
{
$a_privileges = 'y';
echo "\n<h3><b>".get_vocab("utilisateurs_mail_automatique")."</b></h3>";
echo "<p>".$is_mail."</p>";
}
// Si le domaine est restreint, on teste si des utilateurs y ont accès
if ($area_access == 'r')
{
$req_restreint = "SELECT u.login, u.nom, u.prenom FROM ".TABLE_PREFIX."_utilisateurs u left join ".TABLE_PREFIX."_j_user_area j on u.login=j.login WHERE j.id_area = '".$id_area."' order by u.nom, u.prenom";
$res_restreint = grr_sql_query($req_restreint);
$is_restreint = '';
if ($res_restreint)
{
for ($j = 0; ($row_restreint = grr_sql_row($res_restreint, $j)); $j++)
$is_restreint .= $row_restreint[1]." ".$row_restreint[2]." (".$row_restreint[0].")<br />";
}
if ($is_restreint != '')
{
$a_privileges = 'y';
echo "\n<h3><b>".get_vocab("utilisateurs_acces_restreint")."</b></h3>\n";
echo "<p>".$is_restreint."</p>";
}
}
if ($a_privileges == 'n')
echo "<p>".get_vocab("aucun_autilisateur").".</p>";
include "include/trailer.inc.php";