source: trunk/news_admin/inc/class.soacl.inc.php @ 2

Revision 2, 2.1 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare - News                                                        *
4        * http://www.egroupware.org                                                *
5        * --------------------------------------------                             *
6        *  This program is free software; you can redistribute it and/or modify it *
7        *  under the terms of the GNU General Public License as published by the   *
8        *  Free Software Foundation; either version 2 of the License, or (at your  *
9        *  option) any later version.                                              *
10        * --------------------------------------------                             *
11        \**************************************************************************/
12
13
14        class soacl
15        {
16                var $db;
17
18                function soacl()
19                {
20                        copyobj($GLOBALS['phpgw']->db,$this->db);
21                }
22
23                function get_rights($location)
24                {
25                        $result = array();
26                        $sql = "SELECT acl_account, acl_rights from phpgw_acl WHERE acl_appname = 'news_admin' AND acl_location = '$location'";
27                        $this->db->query($sql,__LINE__,__FILE__);
28                        while($this->db->next_record())
29                        {
30                                $result[$this->db->f('acl_account')] = $this->db->f('acl_rights');
31                        }
32                        return $result;
33                }
34
35                function remove_location($location)
36                {
37                        $sql = "delete from phpgw_acl where acl_appname='news_admin' and acl_location='$location'";
38                        $this->db->query($sql,__LINE__,__FILE__);
39                }
40
41                function get_permissions($user, $inc_groups)
42                {
43                        $groups = $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1, $user);
44                        $result = array();
45                        $sql  = 'SELECT acl_location, acl_rights FROM phpgw_acl ';
46                        $sql .= "WHERE acl_appname = 'news_admin' ";
47                        if($inc_groups)
48                        {
49                                $sql .= 'AND acl_account IN('. (int)$user;
50                                $sql .= ($groups ? ',' . implode(',', $groups) : '');
51                                $sql .= ')';
52                        }
53                        else
54                        {
55                                $sql .= 'AND acl_account ='. (int)$user;
56                        }
57                        $this->db->query($sql,__LINE__,__FILE__);
58                        while ($this->db->next_record())
59                        {
60                                $result[$this->db->f('acl_location')] |= $this->db->f('acl_rights');
61                        }
62                        return $result;
63                }
64        }
Note: See TracBrowser for help on using the repository browser.