[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-issues
Subject:    =?UTF-8?B?W0lzc3VlIDIxODVdIE5ldyAtIFdvdWxkIGJlIG5pY2UgaWYgZ3JvdQ==?=
From:       dirkx () tigris ! org
Date:       2004-12-27 17:38:42
Message-ID: 20041227173842.14049.qmail () tigris ! org
[Download RAW message or body]

http://subversion.tigris.org/issues/show_bug.cgi?id=2185
                  Issue #:|2185
                  Summary:|Would be nice if groups where easier to recurse.
                Component:|subversion
                  Version:|1.1.x
                 Platform:|All
                      URL:|
               OS/Version:|All
                   Status:|NEW
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|FEATURE
                 Priority:|P5
             Subcomponent:|mod_authz_svn
              Assigned to:|issues@subversion
              Reported by:|dirkx






------- Additional comments from dirkx@tigris.org Mon Dec 27 09:38:42 -0800 2004 -------
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);
}

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@subversion.tigris.org
For additional commands, e-mail: issues-help@subversion.tigris.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic