-
Notifications
You must be signed in to change notification settings - Fork 0
/
actgravapermissoesgrupo.php
61 lines (56 loc) · 1.07 KB
/
actgravapermissoesgrupo.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
<?php
//--utf8_encode --
session_start();
include_once 'cls/grupo.class.php';
include_once 'cls/permissao.class.php';
include_once 'cls/usuario.class.php';
include_once 'inc/comuns.inc.php';
function Main()
{
header('Content-Type: text/html; charset=iso-8859-1');
$grupo = (isset($_POST["cg"]) && is_numeric($_POST["cg"])) ? $_POST["cg"] : 0;
$permissoes = (isset($_POST["p"]) && (trim($_POST["cg"]) != "")) ? $_POST["p"] : "";
if ($grupo != 0)
{
if ($permissoes != "")
{
try
{
$g = new Grupo();
$g->setCodigo($grupo);
if ($g->DeletaTodasPermissoes())
{
$permissoes = split("-", $permissoes);
foreach($permissoes as $perm)
{
$g->AdicionaPermissaoGrupoUsuario($perm);
}
}
echo("OK");
}
catch (Exception $ex)
{
throw new Exception($ex->getMessage(), $ex->getCode());
}
}
else
{
$g = new Grupo();
$g->setCodigo($grupo);
if ($g->DeletaTodasPermissoes())
{
echo("OK");
}
else
{
echo("Erro");
}
}
}
else
{
echo(Comuns::Idioma("@lng[Grupo não informado]"));
}
}
Main();
?>