source: branches/1.2/contactcenter/inc/class.security_manager.inc.php @ 2

Revision 2, 2.6 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 - Contacts Center                                              *
4  * http://www.egroupware.org                                                 *
5  * Written by:                                                               *
6  *  - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net>         *
7  * ------------------------------------------------------------------------- *
8  *  This program is free software; you can redistribute it and/or modify it  *
9  *  under the terms of the GNU General Public License as published by the    *
10  *  Free Software Foundation; either version 2 of the License, or (at your   *
11  *  option) any later version.                                               *
12  \***************************************************************************/
13
14        class security_manager
15        {
16
17                /*
18               
19                        @function get_available_aliens
20                        @abstract Return an array indicating the ID's of the Available
21                                Aliens Catalogs to this user
22                        @author Raphael Derosso Pereira
23               
24                */
25                function get_available_aliens (  )
26                {
27                }
28
29                function get_permissions ($type = false, $id_entry = false )
30                {
31                        if ($type)
32                        {
33                                switch ($type)
34                                {
35                                        case 'entry':
36                                       
37                                                if ($id_entry)
38                                                {
39                                                        /* First check if this entry is owned by the requesting user */
40                                                        //TODO: The table must be passed as argument
41                                                        $id_entry = (int)$id_entry;
42                                                       
43                                                        $sql  = 'SELECT COUNT(id_contact) AS nfields FROM phpgw_cc_contact WHERE id_contact=\''.$id_entry;
44                                                        $sql .= '\' AND id_owner=\''.$GLOBALS['phpgw_info']['user']['account_id'].'\'';
45
46                                                        $result = $GLOBALS['phpgw']->db->query($sql);
47
48                                                        if ($result)
49                                                        {
50                                                                if ($GLOBALS['phpgw']->db->next_record())
51                                                                {
52                                                                        $result = $GLOBALS['phpgw']->db->f('nfields');
53
54                                                                        if ($result)
55                                                                        {
56                                                                                return array(
57                                                                                        'read'   => true,
58                                                                                        'edit'   => true,
59                                                                                        'delete' => true,
60                                                                                        'acl'    => true,
61                                                                                );
62                                                                        }
63                                                                }
64                                                        }
65                                                }
66                                               
67                                                return array(
68                                                        'read'   => false,
69                                                        'edit'   => false,
70                                                        'delete' => false,
71                                                        'acl'    => false,
72                                                );
73                                }
74                        }
75                       
76                        $return['read'] = true;
77                        $return['write'] = true;
78                        $return['create'] = true;
79                        $return['remove'] = true;
80                        $return['cities'] = array('c');
81                        $return['states'] = array('c');
82                       
83                        return $return;
84                }
85
86                function get_alien_permissions ( $id_owner_alien )
87                {
88                }
89       
90                function get_global_permissions (  )
91                {
92                }
93       
94                function set_access_permitions_to_global ( $id_user, $rights )
95                {
96                }
97       
98        }
99?>
Note: See TracBrowser for help on using the repository browser.