aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/acl.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-10-02 04:49:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-10-02 04:49:28 +0000
commit7215f74b89640f642d219b0675ef3997fc4c8fc2 (patch)
tree74533eb713b1d5120d54f40361d5388dfe178125 /src/backend/utils/adt/acl.c
parent46cf925728a96da84d53801cb337846a35258cba (diff)
downloadpostgresql-7215f74b89640f642d219b0675ef3997fc4c8fc2.tar.gz
postgresql-7215f74b89640f642d219b0675ef3997fc4c8fc2.zip
Make default ACL be consistent --- ie, starting point for ChangeAcl
is the same as the access permissions granted when a relation's relacl field is NULL, ie, owner=all rights, world=no rights.
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r--src/backend/utils/adt/acl.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index c4f1228dbcf..3d43a45cd1e 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.48 2000/07/31 22:39:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.49 2000/10/02 04:49:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -334,12 +334,23 @@ aclitemgt(AclItem *a1, AclItem *a2)
(a1->ai_idtype == a2->ai_idtype && a1->ai_id > a2->ai_id));
}
+
+/*
+ * acldefault() --- create an ACL describing default access permissions
+ *
+ * Change this routine if you want to alter the default access policy for
+ * newly-created tables (or any table with a NULL acl entry in pg_class)
+ */
Acl *
-aclownerdefault(char *relname, AclId ownerid)
+acldefault(char *relname, AclId ownerid)
{
Acl *acl;
AclItem *aip;
+#define ACL_WORLD_DEFAULT (ACL_NO)
+/* #define ACL_WORLD_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU) */
+#define ACL_OWNER_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU)
+
acl = makeacl(2);
aip = ACL_DAT(acl);
aip[0].ai_idtype = ACL_IDTYPE_WORLD;
@@ -351,19 +362,6 @@ aclownerdefault(char *relname, AclId ownerid)
return acl;
}
-Acl *
-acldefault(char *relname)
-{
- Acl *acl;
- AclItem *aip;
-
- acl = makeacl(1);
- aip = ACL_DAT(acl);
- aip[0].ai_idtype = ACL_IDTYPE_WORLD;
- aip[0].ai_id = ACL_ID_WORLD;
- aip[0].ai_mode = IsSystemRelationName(relname) ? ACL_RD : ACL_WORLD_DEFAULT;
- return acl;
-}
/*
* Add or replace an item in an ACL array.