forked from dbmail/dbmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdm_acl.h
106 lines (92 loc) · 2.88 KB
/
dm_acl.h
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
/*
Copyright (C) 2004 IC & S dbmail@ic-s.nl
This program 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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* \file acl.h
*
* \brief header file for ACL (access control list) functions of DBMail.
* see RFC 2086 for details on IMAP ACL
*
* \author (c) 2004 IC&S
*/
/**
* different rights a user can have on a mailbox
*/
#ifndef DM_ACL_H
#define DM_ACL_H
#include "dbmailtypes.h"
#include "dm_mailboxstate.h"
/**
* \brief sets new rights to a mailbox for a user.
* \param userid id of user
* \param mboxid id of mailbox
* \param rightsstring string of righs
* \return
* - -1 on error
* - 1 on success
*/
int acl_set_rights(uint64_t userid, uint64_t mboxid, const char *rightsstring);
/**
* \brief delete identifier, rights pair for selected user for mailbox
* \param userid id of user
* \param mboxid id of mailbox
* \return
* - -1 on error
* - 0 if nothing removed (i.e. no acl was found)
* - 1 if acl removed
*/
//int acl_delete_acl(uint64_t userid, uint64_t mboxid);
#define acl_delete_acl(a,b) db_acl_delete_acl((a),(b))
/**
* \brief checks if a user has a certain right to a mailbox
* \param userid id of user
* \param mboxid id of mailbox
* \param right the right to check for
* \return
* - -1 on db error
* - 0 if no right
* - 1 if user has this right
*/
int acl_has_right(MailboxState_T S, uint64_t userid, ACLRight right);
/**
* \brief get complete acl for a mailbox
* \param mboxid id of mailbox
* \return
* - NULL on error
* - acl string (list of identifier-rights pairs, might by empty)
* \note string should be freed by caller
*/
char *acl_get_acl(uint64_t mboxid);
/**
* \brief list rights that may be granted to a user on a mailbox
* \param userid id of user
* \param mboxid id of mailbox
* \return
* - NULL on error
* - string of rights otherwise (SEE RFC for details)
* \note string should be freed by caller
*/
const char *acl_listrights(uint64_t userid, uint64_t mboxid);
/**
* \brief list rights that a user has on a mailbox
* \param userid id of user
* \param mboxid id of mailbox
* \return
* - NULL on error
* - string of rights otherwise (SEE RFC)
* \note string should be freed by caller
*/
/*@null@*/ char *acl_myrights(uint64_t userid, uint64_t mboxid);
#endif