| 1 |
/* |
| 2 |
Access control |
| 3 |
Copyright (C) 2001-2007, Joe Orton <[email protected]> |
| 4 |
Copyright (C) 2001, Arun Garg <[email protected]> |
| 5 |
Copyright (C) 2007 Henrik Holst <[email protected]> |
| 6 |
|
| 7 |
This library is free software; you can redistribute it and/or |
| 8 |
modify it under the terms of the GNU Library General Public |
| 9 |
License as published by the Free Software Foundation; either |
| 10 |
version 2 of the License, or (at your option) any later version. |
| 11 |
|
| 12 |
This library is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
Library General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU Library General Public |
| 18 |
License along with this library; if not, write to the Free |
| 19 |
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 20 |
MA 02111-1307, USA |
| 21 |
|
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef NE_ACL3744_H |
| 25 |
#define NE_ACL3744_H |
| 26 |
|
| 27 |
#include "ne_session.h" |
| 28 |
|
| 29 |
NE_BEGIN_DECLS |
| 30 |
|
| 31 |
#define NE_ACL_READ (0x0001) |
| 32 |
#define NE_ACL_WRITE (0x0002) |
| 33 |
#define NE_ACL_WRITE_PROPERTIES (0x0004) |
| 34 |
#define NE_ACL_WRITE_CONTENT (0x0008) |
| 35 |
#define NE_ACL_UNLOCK (0x0010) |
| 36 |
#define NE_ACL_READ_ACL (0x0020) |
| 37 |
#define NE_ACL_READ_CUPRIVSET (0x0040) |
| 38 |
#define NE_ACL_WRITE_ACL (0x0080) |
| 39 |
#define NE_ACL_BIND (0x0100) |
| 40 |
#define NE_ACL_UNBIND (0x0200) |
| 41 |
#define NE_ACL_ALL (0x0400) |
| 42 |
|
| 43 |
enum ne_acl_target { |
| 44 |
ne_acl_href, |
| 45 |
ne_acl_property, |
| 46 |
ne_acl_all, |
| 47 |
ne_acl_authenticated, |
| 48 |
ne_acl_unauthenticated, |
| 49 |
ne_acl_self |
| 50 |
}; |
| 51 |
|
| 52 |
enum ne_acl_optype { |
| 53 |
ne_acl_grant, |
| 54 |
ne_acl_deny |
| 55 |
}; |
| 56 |
|
| 57 |
/* A simplified representation of an Access Control Element (ACE): */ |
| 58 |
typedef struct { |
| 59 |
/* Identify the principal(s) to which this ACE applies: */ |
| 60 |
enum ne_acl_target target; |
| 61 |
|
| 62 |
/* Whether to grant or deny access: */ |
| 63 |
enum ne_acl_optype type; |
| 64 |
|
| 65 |
/* If target == ne_acl_href, tname must be non-NULL and give the |
| 66 |
* principal URL. If target == ne_acl_property, tname must be |
| 67 |
* non-NULL and be a property name, including an XML namespace |
| 68 |
* definition, if appropriate (the default namespace being |
| 69 |
* "DAV:"). This restricts access as described at: |
| 70 |
* http://tools.ietf.org/html/rfc3744#section-5.5.1 */ |
| 71 |
char *tname; |
| 72 |
|
| 73 |
/* The set of privileges to be restricted; a bit mask of one or |
| 74 |
* more of the NE_ACL_* constants defined above: */ |
| 75 |
unsigned int privileges; |
| 76 |
|
| 77 |
} ne_acl_entry; |
| 78 |
|
| 79 |
/* Set the ACL for the given resource to the list of ACL entries. */ |
| 80 |
int ne_acl3744_set(ne_session *sess, const char *path, |
| 81 |
const ne_acl_entry entries[], int numentries); |
| 82 |
|
| 83 |
NE_END_DECLS |
| 84 |
|
| 85 |
#endif /* NE_ACL3744_H */ |