Tags:
create new tag
view all tags

Question

This isn't so much a question as a bug report and/or suggestion for clarifying the documentation. (I'm a new twiki user, so forgive me if this issue has already been dealt with.)

I was having a hard time making the access control work, and I finally tracked it down to a code/documentation discrepancy on how groups are defined.

In the function prvGetUsersOfGroup of Access.pm, we find

        if( /^\s+\*\sSet\sGROUP\s*\=\s*(.*)/ ) { ...

This is a very strict regular expression: The asterisk before "Set" is mandatory, and there has to be precisely one space between "Set" and "GROUP". There's no hint in the documentation that the formatting is this fragile.

May I suggest that the regular expression be changed to

        if( /^\s*(?:\*\s+)?Set\s+GROUP\s*\=\s*(.*)/ ) { ...

In other words, {beginning of line}{optional white space}{optional bullet}"Set"{mandatory white space of any length}"GROUP"{etc...}.

Alternatively, the documentation could be clarified.

This might be an issue with all "Set VAR = .." constructs -- I haven't checked yet.

  • TWiki version: 20011201

-- KevinWalker - 04 May 2002

Answer

The syntax is strict by design so that there are no unwanted side effects; a bullet is required for a variable. The TWikiAccessControl docs have been updated accordingly.

-- PeterThoeny - 04 May 2002

OK, thanks for updating documentation. There's still the issue of the single whitespace character between "Set" and "GROUP". Perhaps the documentation should mention that as well. (Most programming languages, markup languages, etc are not sensitive to the exact size of whitespace in this way, so the potential for confusion definitely exists. And if this regular expression fails to match, it's difficult for the user to track down the problem -- no warnings are emitted.)

A better solution, in my opinion, whould be to change "Set\sGROUP" to "Set[ \t]+GROUP" in Access.pm (and a similar change at one other place in that file). Note that as currently written, the regex will accept " * Set\nGROUP...".

-- KevinWalker - 04 May 2002

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2002-05-04 - KevinWalker
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.