dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / server / access.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: access.h /main/4 1995/11/09 12:39:54 rswiston $ */
24 /*
25  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26  *  (c) Copyright 1993, 1994 International Business Machines Corp.
27  *  (c) Copyright 1993, 1994 Novell, Inc.
28  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
29  */
30
31 #ifndef _ACCESS_H
32 #define _ACCESS_H
33
34 #include "ansi_c.h"
35 #include "cm.h"
36 #include "rtable4.h"
37 #include "cmscalendar.h"
38
39 #define _DTCMS_HAS_VIEW_CALENDAR_ATTR_ACCESS(a) \
40                 ((a) & (CSA_VIEW_CALENDAR_ATTRIBUTES | CSA_OWNER_RIGHTS))
41
42 #define _DTCMS_HAS_INSERT_CALENDAR_ATTR_ACCESS(a) \
43                 ((a) & (CSA_INSERT_CALENDAR_ATTRIBUTES | CSA_OWNER_RIGHTS))
44
45 #define _DTCMS_HAS_CHANGE_CALENDAR_ATTR_ACCESS(a) \
46                 ((a) & (CSA_CHANGE_CALENDAR_ATTRIBUTES | CSA_OWNER_RIGHTS))
47
48 #define _DTCMS_HAS_VIEW_ACCESS(a) ((a) & (CSA_VIEW_PUBLIC_ENTRIES | \
49                                             CSA_VIEW_CONFIDENTIAL_ENTRIES | \
50                                             CSA_VIEW_PRIVATE_ENTRIES | \
51                                             CSA_ORGANIZER_RIGHTS | \
52                                             CSA_SPONSOR_RIGHTS | \
53                                             CSA_OWNER_RIGHTS))
54
55 #define _DTCMS_HAS_INSERT_ACCESS(a) ((a) & (CSA_INSERT_PUBLIC_ENTRIES | \
56                                             CSA_INSERT_CONFIDENTIAL_ENTRIES | \
57                                             CSA_INSERT_PRIVATE_ENTRIES | \
58                                             CSA_OWNER_RIGHTS))
59
60 #define _DTCMS_HAS_CHANGE_ACCESS(a) ((a) & (CSA_CHANGE_PUBLIC_ENTRIES | \
61                                             CSA_CHANGE_CONFIDENTIAL_ENTRIES | \
62                                             CSA_CHANGE_PRIVATE_ENTRIES | \
63                                             CSA_ORGANIZER_RIGHTS | \
64                                             CSA_SPONSOR_RIGHTS | \
65                                             CSA_OWNER_RIGHTS))
66
67 #define _DTCMS_HAS_V4_BROWSE_ACCESS(a) \
68                 ((a) & (access_read_4 | CSA_OWNER_RIGHTS))
69
70 #define _DTCMS_HAS_V4_WRITE_ACCESS(a) \
71                 ((a) & (access_write_4 | CSA_OWNER_RIGHTS))
72
73 extern CSA_return_code _DtCmsV4LoadAndCheckAccess P((
74                         struct svc_req  *svcrq,
75                         char            *target,
76                         char            **sender,
77                         uint            *access,
78                         _DtCmsCalendar  **cal));
79
80 extern CSA_return_code _DtCmsV5LoadAndCheckAccess P((
81                         struct svc_req  *svcrq,
82                         char            *target,
83                         char            **sender,
84                         uint            *access,
85                         _DtCmsCalendar  **cal));
86
87 extern CSA_return_code _DtCmsGetClientInfo P((
88                         struct svc_req *svcrq,
89                         char **source));
90
91 extern boolean_t _DtCmsIsFileOwner P((char *owner, char *user, char *target));
92
93 extern void _DtCmsShowAccessList P((Access_Entry_4 *l));
94
95 extern Access_Entry_4 *_DtCmsCalendarAccessList P((_DtCmsCalendar *cal));
96
97 extern Privacy_Level_4 _DtCmCheckPrivacyLevel P((char **p_src, Appt_4 *p_appt));
98
99 extern CSA_return_code _DtCmsCheckViewAccess P((
100                         char *user,
101                         uint access,
102                         cms_entry *eptr));
103
104 extern CSA_return_code _DtCmsCheckChangeAccess P((
105                         char    *user,
106                         uint    access,
107                         cms_entry *eptr));
108
109 extern uint _DtCmsClassToInsertAccess P((cms_entry *entry));
110
111 extern uint _DtCmsClassToViewAccess P((cms_entry *entry));
112
113 extern uint _DtCmsClassToChangeAccess P((cms_entry *entry));
114
115 #endif