[pmwiki-users] How to Read Wiki File from Shell . . .

Joachim Durchholz jo at durchholz.org
Mon Jun 27 07:27:27 CDT 2005


Patrick R. Michaud wrote:

> On Mon, Jun 27, 2005 at 11:44:19AM +0200, Joachim Durchholz wrote:
> 
>> It may be useful to set up a "command-line mode" for PmWiki, to be
>> activated when PmWiki finds it's not running in a CGI environment.
>> In that case, it could take its parameters from the command line
>> instead from the GET variables, and permission checking based on
>> the name of the Unix user it's running as. That would take the
>> permission checking pains out, and also make it easier to test some
>> things from the command line :-)
> 
> I'm not sure what you mean by "permission checking" here -- do you 
> mean page authorization or file permissions?

PmWiki action authorisation.

> If you mean page authorization, then I'd suggest that we have
> authorization come from the command line or environment variables.

When it comes to user->software communication, I've got a strong 
personal bias against using environment variables. They tend to be 
variable when expected to be always the same, and fixed when expected to 
change ;-P
If at all, I'd use a configuration file.

When it comes to program->program communication, I'd use a pipe. Or a 
named pipe if necessary. There are enough communications channels :-)

> Checking based on the name of the unix user presumes (1) pages are
> protected by username, not passwords, (2) and that the PmWiki 
> username(s) match those of the unix host, and (3) that we're running
> under Unix.  :-)

1) I think the password protection scheme doesn't make much sense in a 
command-line environment. Either the OS offers a user-based scheme, in 
which case PmWiki should simply use it (*for command-line operation!*), 
or the OS offers no protection, in which case any attempts at security 
are easily circumvented anyway.

2) The names need not match if the authentication framework 
distinguishes between names from different sources. I.e. the Unix 
account "jo" isn't considered the same as the PmWiki user "jo". (As an 
afterthought, it might make sense to tell PmWiki about aliases, e.g. 
that Unix user "jo" is really the same as PmWiki user "JoachimDurchholz".)

3) All OSes with user accounts have a notion of the current user name :-)
Unfortunately, PHP doesn't offer a standard function to access it. One 
would have to identify the operating system (either with the Posix 
extension, in which case posix_getlogin is your friend, or Windows, in 
which case we'd need the w32api *gulp*).


Regards,
Jo



More information about the pmwiki-users mailing list