Details
-
New Feature
-
Status: Closed
-
Trivial
-
Resolution: Duplicate
-
1.1.x
-
None
Description
One often has configs like [groups] @class5 = peter, fred, mary @class4 = @class5, joan @class3 = @class4, brian @all = @class3, ape, nut, mies [/] * = [/docs] rw = @all [/docs/clearances] * = rw = @class3 [/docs/clearances/secret] * = rw = @class4 Though the expansion ought to be done at run time -- I found the small change below to group_countains_user() to make the files a LOT more readable. static int _group_contains_user(int depth, svn_config_t *cfg, const char *group, const char *user, apr_pool_t *pool) { const char *value; apr_array_header_t *list; int i; /* Ideally we do this expansion at read-in time of course. */ if (depth > 50) { ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool, "Groups recurse too deep"); return 0; } svn_config_get(cfg, &value, "groups", group, ""); list = svn_cstring_split(value, "|", TRUE, pool); /* XXX changed - utf8 string for OTAN XXX */ for (i = 0; i < list->nelts; i++) { const char *group_user = APR_ARRAY_IDX(list, i, char *); if (*group_user == '@') { if (_group_contains_user(depth+1,cfg, group_user+1, user, pool)) return 1; } else if (!strcmp(user, group_user)) return 1; } return 0; } static int group_contains_user(svn_config_t *cfg, const char *group, const char *user, apr_pool_t *pool) { return _group_contains_user(0,cfg, group, user, pool); }
Original issue reported by dirkx
Attachments
Issue Links
- duplicates
-
SVN-2085 [PATCH] Allow group definitions to refer to other groups
- Closed