• 000013 by yuri@... on 2008/05/21 at 05:54 GMT
  • 000012 by mmburke@... on 2008/05/21 at 05:27 GMT

Page Content

From tampo_8 at yahoo.com  Mon Feb 18 12:29:35 2008
From: tampo_8 at yahoo.com (=?iso-8859-1?Q?S=E9rgio_Medeiros?=)
Date: Mon Feb 18 12:32:10 2008
Subject: [Sputnik-list] Permissions
Message-ID: <44404.33265.qm@web54108.mail.re2.yahoo.com>

Hi!

I would like to learn how to use the permissions system of Sputnik.
Following the link http://sputnik.freewisdom.org/en/Permissions
I could only see a blank page.

I would like to "hide" some pages, so google or non-registered users
could not see them.
Is it possible to put more information about this topic? :-)


S?rgio






      Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento!
http://br.mail.yahoo.com/


From yuri at sims.berkeley.edu  Tue Feb 19 05:41:27 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Tue Feb 19 05:43:33 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <44404.33265.qm@web54108.mail.re2.yahoo.com>
References: <44404.33265.qm@web54108.mail.re2.yahoo.com>
Message-ID: <fa4efbc00802182341x608a926ch2d9f6523bc8069f6@mail.gmail.com>

>  I would like to learn how to use the permissions system of Sputnik.
>  Following the link http://sputnik.freewisdom.org/en/Permissions
>  I could only see a blank page.

The permissions language basically has two commands "allow" and "deny"

You allow or deny certain users or "all" certain classes of actions.
For example, @Lua_Config specifies:

permissions= [=[
      deny(all, "save")
      allow("Admin", "save")
]=]

I.e., first prohibit all to save, then make an exception for Admin.

Those are inherited through concatination.  So, if a node inherits
from @Lua_Config and sets permissions to allow("Sergio", "save") then
only "Admin" and "Sergio" will be allowed to save.

"save" is the only class of actions that is supported at the moment.
See actions.post in sputnik/actions/wiki.lua
http://code.google.com/p/sputnik-wiki/source/browse/trunk/rocks/sputnik/lua/sputnik/actions/wiki.lua

At the moment, if you want to make some pages invisible, you would
need to change wiki.lua to check for whether the user is allowed to
"view".  Note that presumably not being allowed to view would mean
also not being allowed to see history, diffs, etc.  Which is why I am
talking about "classes of actions" - you don't want to prohibit stuff
on per-action basis.  (Or maybe you do.)

If you send me a diff that adds handing for "view" I will be most delighted. :)

Also, now that we've got you on the spot: can I somehow bribe you into
updating the versium.storage.svn
(http://code.google.com/p/versium/source/browse/trunk/versium/storage/svn.lua)
and checking it in under
rocks/versium-svn/lua/versium/storage/svn.lua?  Did I mention before
on this list that I think Natal is most certainly one of Brazil's two
most beautiful cities?  (See pictures if you don't believe
http://www.freewisdom.org/en/all/entries/2007/10/08/natal/ )

- yuri


From tampo_8 at yahoo.com  Tue Feb 19 10:14:54 2008
From: tampo_8 at yahoo.com (=?iso-8859-1?Q?S=E9rgio_Medeiros?=)
Date: Tue Feb 19 10:17:31 2008
Subject: Res: [Sputnik-list] Permissions
Message-ID: <891590.12752.qm@web54109.mail.re2.yahoo.com>

Hi!

> At 
the 
moment, 
if 
you 
want 
to 
make 
some 
pages 
invisible, 
you 
would
> need 
to 
change 
wiki.lua 
to 
check 
for 
whether 
the 
user 
is 
allowed 
to
> "view".  
Note 
that 
presumably 
not 
being 
allowed 
to 
view 
would 
mean
> also 
not 
being 
allowed 
to 
see 
history, 
diffs, 
etc.  
Which 
is 
why 
I 
am
> talking 
about 
"classes 
of 
actions" 
- 
you 
don't 
want 
to 
prohibit 
stuff
> on 
per-action 
basis.  
(Or 
maybe 
you 
do.)

I am trying to use Sputnik for the PhD/Master students' wiki. The "view"
action is one that I would like to have, so the students can discuss some
more polemic topics without worrying about who will read that stuff.

> If 
you 
send 
me 
a 
diff 
that 
adds 
handing 
for 
"view" 
I 
will 
be 
most 
delighted. 
:)

Well, what can I say? Russo folgado? :-)

> Also, 
now 
that 
we've 
got 
you 
on 
the 
spot: 
can 
I 
somehow 
bribe 
you 
into
> updating 
the 
versium.storage.svn
> (http://code.google.com/p/versium/source/browse/trunk/versium/storage/svn.lua)
> and 
checking 
it 
in 
under
> rocks/versium-svn/lua/versium/storage/svn.lua?

Sure, I will take a look on this the next weekend, because Friday we have a meeting
with our advisor and we need to prepare something!

> Did 
I 
mention 
before
> on 
this 
list 
that 
I 
think 
Natal 
is 
most 
certainly 
one 
of 
Brazil's 
two
> most 
beautiful 
cities?  
(See 
pictures 
if 
you 
don't 
believe
> http://www.freewisdom.org/en/all/entries/2007/10/08/natal/ 
)

Yes, I had already seen your pictures, good job :-)

I was there during January and could see the new bridge. The wikipedia
entry (http://en.wikipedia.org/wiki/Natal%2C_Rio_Grande_do_Norte) has many
beautiful photos too, maybe the next summer the city will be full of Sputnik's
users :-D

Sergio






      Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento!
http://br.mail.yahoo.com/


From yuri at sims.berkeley.edu  Tue Feb 19 16:00:07 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Tue Feb 19 16:02:14 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <891590.12752.qm@web54109.mail.re2.yahoo.com>
References: <891590.12752.qm@web54109.mail.re2.yahoo.com>
Message-ID: <fa4efbc00802191000y4044027co7a212eee6dc0cfa6@mail.gmail.com>

Note that if you want to block access to _all_ pages rather than to
just some, it might be easier to either add .htaccess (if you are
using Apache) or make a change in sputnik/init.lua in
:translate_request(), in the last if/else block.

This is not to say that I think the user should have to change code to
add this feature: I am looking forward to suggestions about how this
_should_ work.

 - yuri


From tampo_8 at yahoo.com  Sat Feb 23 17:56:46 2008
From: tampo_8 at yahoo.com (=?iso-8859-1?Q?S=E9rgio_Medeiros?=)
Date: Sat Feb 23 17:59:36 2008
Subject: Res: [Sputnik-list] Permissions
Message-ID: <745725.96760.qm@web54111.mail.re2.yahoo.com>

Well, I made some changes and put "svn.lua" in
the right place (revision 209/210).

I could not test the changes, because there was
not a "Test" directory, as there is in the Versium
repository. I just did "luac svn.lua" to make sure
the file was compiling.

Maybe now is a good time to update the Versium
repository and make a "rock" of Versium (I could
not find one).

Sergio

----- Mensagem original ----
De: Yuri Takhteyev <yuri@sims.berkeley.edu>
Para: S?rgio Medeiros <tampo_8@yahoo.com>
Enviadas: S?bado, 23 de Fevereiro de 2008 16:51:38
Assunto: Re: [Sputnik-list] Permissions

oh, 
I 
see.  
sorry 
for 
not 
mentioning 
this.  
the 
good 
news 
is 
that 
the
svn.lua 
is 
unchanged.

 
- 
yuri

On 
Sat, 
Feb 
23, 
2008 
at 
10:48 
AM, 
S?rgio 
Medeiros 
<tampo_8@yahoo.com> 
wrote:
> 
Hum...
>
>  
now 
I 
see 
the 
point! 
I 
was 
looking 
for 
things 
in 
the 
Versium
>  
repository, 
but 
the 
most 
recent 
things 
are 
in 
the 
Sputnik
>  
repository 
:-)
>
>  
So, 
I 
will 
take 
a 
look 
on 
this 
now 
and 
see 
what 
need 
to 
be
>  
done.
>
>  
Sergio
>
>  
----- 
Mensagem 
original 
----
>  
De: 
Yuri 
Takhteyev 
<yuri@sims.berkeley.edu>
>  
Para: 
S?rgio 
Medeiros 
<tampo_8@yahoo.com>
>  
Cc: 
Sputnik 
<sputnik-list@lists.luaforge.net>
>  
Enviadas: 
Ter?a-feira, 
19 
de 
Fevereiro 
de 
2008 
5:41:27
>  
Assunto: 
Re: 
[Sputnik-list] 
Permissions
>
>
>
>  
>
>  
I
>  
would
>  
like
>  
to
>  
learn
>  
how
>  
to
>  
use
>  
the
>  
permissions
>  
system
>  
of
>  
Sputnik.
>  
>
>  
Following
>  
the
>  
link
>  
http://sputnik.freewisdom.org/en/Permissions
>  
>
>  
I
>  
could
>  
only
>  
see
>  
a
>  
blank
>  
page.
>
>  
The
>  
permissions
>  
language
>  
basically
>  
has
>  
two
>  
commands
>  
"allow"
>  
and
>  
"deny"
>
>  
You
>  
allow
>  
or
>  
deny
>  
certain
>  
users
>  
or
>  
"all"
>  
certain
>  
classes
>  
of
>  
actions.
>  
For
>  
example,
>  
@Lua_Config
>  
specifies:
>
>  
permissions=
>  
[=[
>
>
>
>  
deny(all,
>  
"save")
>
>
>
>  
allow("Admin",
>  
"save")
>  
]=]
>
>  
I.e.,
>  
first
>  
prohibit
>  
all
>  
to
>  
save,
>  
then
>  
make
>  
an
>  
exception
>  
for
>  
Admin.
>
>  
Those
>  
are
>  
inherited
>  
through
>  
concatination.
>  
So,
>  
if
>  
a
>  
node
>  
inherits
>  
from
>  
@Lua_Config
>  
and
>  
sets
>  
permissions
>  
to
>  
allow("Sergio",
>  
"save")
>  
then
>  
only
>  
"Admin"
>  
and
>  
"Sergio"
>  
will
>  
be
>  
allowed
>  
to
>  
save.
>
>  
"save"
>  
is
>  
the
>  
only
>  
class
>  
of
>  
actions
>  
that
>  
is
>  
supported
>  
at
>  
the
>  
moment.
>  
See
>  
actions.post
>  
in
>  
sputnik/actions/wiki.lua
>  
http://code.google.com/p/sputnik-wiki/source/browse/trunk/rocks/sputnik/lua/sputnik/actions/wiki.lua
>
>
>
> 
At
>  
the
>  
moment,
>  
if
>  
you
>  
want
>  
to
>  
make
>  
some
>  
pages
>  
invisible,
>  
you
>  
would
>  
need
>  
to
>  
change
>  
wiki.lua
>  
to
>  
check
>  
for
>  
whether
>  
the
>  
user
>  
is
>  
allowed
>  
to
>  
"view".
>  
Note
>  
that
>  
presumably
>  
not
>  
being
>  
allowed
>  
to
>  
view
>  
would
>  
mean
>  
also
>  
not
>  
being
>  
allowed
>  
to
>  
see
>  
history,
>  
diffs,
>  
etc.
>  
Which
>  
is
>  
why
>  
I
>  
am
>  
talking
>  
about
>  
"classes
>  
of
>  
actions"
>  
-
>  
you
>  
don't
>  
want
>  
to
>  
prohibit
>  
stuff
>  
on
>  
per-action
>  
basis.
>  
(Or
>  
maybe
>  
you
>  
do.)
>
>
> 
If
>  
you
>  
send
>  
me
>  
a
>  
diff
>  
that
>  
adds
>  
handing
>  
for
>  
"view"
>  
I
>  
will
>  
be
>  
most
>  
delighted.
>  
:)
>
>
>
> 
Also,
>  
now
>  
that
>  
we've
>  
got
>  
you
>  
on
>  
the
>  
spot:
>  
can
>  
I
>  
somehow
>  
bribe
>  
you
>  
into
>  
updating
>  
the
>  
versium.storage.svn
>  
(http://code.google.com/p/versium/source/browse/trunk/versium/storage/svn.lua)
>  
and
>  
checking
>  
it
>  
in
>  
under
>  
rocks/versium-svn/lua/versium/storage/svn.lua?
>
>
> 
Did
>  
I
>  
mention
>  
before
>  
on
>  
this
>  
list
>  
that
>  
I
>  
think
>  
Natal
>  
is
>  
most
>  
certainly
>  
one
>  
of
>  
Brazil's
>  
two
>  
most
>  
beautiful
>  
cities?
>  
(See
>  
pictures
>  
if
>  
you
>  
don't
>  
believe
>  
http://www.freewisdom.org/en/all/entries/2007/10/08/natal/
>  
)
>
>  
-
>  
yuri
>
>
>
>
>
>
>
>  
  
  
 
Abra 
sua 
conta 
no 
Yahoo! 
Mail, 
o 
?nico 
sem 
limite 
de 
espa?o 
para 
armazenamento!
>  
http://br.mail.yahoo.com/
>



-- 
Yuri 
Takhteyev
Ph.D. 
Candidate, 
UC 
Berkeley 
School 
of 
Information
http://takhteyev.org/, 
http://www.freewisdom.org/





      Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento!
http://br.mail.yahoo.com/


From yuri at sims.berkeley.edu  Sat Feb 23 19:09:07 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Sat Feb 23 19:11:28 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <745725.96760.qm@web54111.mail.re2.yahoo.com>
References: <745725.96760.qm@web54111.mail.re2.yahoo.com>
Message-ID: <fa4efbc00802231309l6dd64fe6m4ca366603ccd3555@mail.gmail.com>

>  I could not test the changes, because there was
>  not a "Test" directory, as there is in the Versium
>  repository. I just did "luac svn.lua" to make sure
>  the file was compiling.

Well, the most comprehensive test at this point is whether Sputnik
will run with it. :)  The relatively simple test suite included with
the original versium was useful when Sputnik wasn't ported to Versium,
and would probably still be useful for someone trying to do a new
implementation of Versium.  However, running it with Sputnik would
test it a lot more thoroughly.

I managed to get half-way there with this module.  Here is what I did:
http://sputnik.freewisdom.org/en/With_SVN  Then I got an error
message.  Any suggestions?

>  Maybe now is a good time to update the Versium
>  repository and make a "rock" of Versium (I could
>  not find one).

There is a rock of versium in http://sputnik.freewisdom.org/rocks/.
I'll email it to Hisham for inclusion in the luarocks repository once
it's known to be stable.

Also, I am keeping versium in the sputnik repository for now because
I've had to make lots of small changes to it which were mostly
sputnik-driven.  You are right that now might be the time to start
treating it as more of its own thing, but I wanted to wrap up a few
things first, such as the svn implemetation and documentation.

 - yuri


From tampo_8 at yahoo.com  Mon Feb 25 22:31:11 2008
From: tampo_8 at yahoo.com (=?iso-8859-1?Q?S=E9rgio_Medeiros?=)
Date: Mon Feb 25 22:34:08 2008
Subject: Res: [Sputnik-list] Permissions
Message-ID: <265342.41656.qm@web54109.mail.re2.yahoo.com>

> I managed to get half-way there with this module.  Here is what I did:
> http://sputnik.freewisdom.org/en/With_SVN  Then I got an error
> message.  Any suggestions?

I tried to follow your instructions, assuming I have installed
Sputnik using the script "sputnik_install_2008_02_16.sh".

> Get the latest revision from Sputnik's subversion
> svn update rocks/versium

This was a little bit confusing, because does not do anything.

> Copy svn.lua to your existing Sputnik installation: 
> cp rocks/versium/lua/versium/storage/svn.lua /home/yuri/sputnik/share/lua/5.1/versium/storage/


I did not understand this also, because there is not such directory, "share/lua/5.1/versium".

So, what I did? :-)
First, I installed "luasvn" using the local "luarocks" as you did.
Then I got the last snapshot of Sputnik from the google repository and copied the "svn.lua" file to directory "rocks/versium/8.01.01-0/lua/versium/storage/" of another Sputnik that I installed using the script "sputnik_install_2008_02_16.sh"

After, I edited the "rocks/manifest", adding the line
", ['versium.storage.svn']={'versium/8.01.01-0'}"

Then, I spent some hours trying to find the error in "svn.lua" and the good news
is that Versium + Subversion + Sputnik is working now (at least in my
computer) :-)

Yuri, can you try to follow these steps and see if you get Spuntik working with Subversion?
I updated the version of "svn.lua" in the repository (revision 220)


Sergio





      Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento!
http://br.mail.yahoo.com/


From yuri at sims.berkeley.edu  Tue Feb 26 06:22:57 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Tue Feb 26 06:25:31 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <265342.41656.qm@web54109.mail.re2.yahoo.com>
References: <265342.41656.qm@web54109.mail.re2.yahoo.com>
Message-ID: <fa4efbc00802260022q1ff1d825sc1bef5fa9190fb03@mail.gmail.com>

Indeed it works!  Nice!

I've been thinking of making it into a rock of it's own
("versium-svn") which would then specify a dependency on luasvn.  Then
to install it one would just need to do "luarocks install versium-svn"
and luasvn would get installed automatically.  What do you think?

Also, about the "Create a repository" step.  Would it be possible to
wrap this into the module somehow?  I.e., check if the repository
exists and if it doesn't create it?  Alternatively, those four lines
could just be put into a small script that could be put into the bin
directory as a part of the installation, so that the first two steps
in the installation would be:

    luarocks install versium-svn
    ./bin/lua5.1 ./bin/luasvn_init_repository.lua my_repos wiki-data

Oh, there is also a small problem: I can't create new nodes. :(

Sputnik ran but failed due to an unexpected error.

stack traceback:
	...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:451: in function 'err'
	/home/yuri/sputnik/share/lua/5.1/coxpcall.lua:24: in function
	(tail call): ?
	(tail call): ?
	(tail call): ?
	...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:454: in
function 'protected_run'
	...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:528: in
function 'cgilua_run'
	sputnik.lua:11: in main chunk


I haven't had a chance to debug it, but I am guessing that somehow
node_exists() returns true and versium then tries to actually read the
file.  But for files that are created programmatically (all the
initial pages), I can edit them successfully.

Thanks for the work!

>  I tried to follow your instructions, assuming I have installed
>  Sputnik using the script "sputnik_install_2008_02_16.sh".

Sorry for the confusing instructions, but I suppose they are moot now.

 - yuri

--
http://www.freewisdom.org/en/pipa/albums/


From tampo_8 at yahoo.com  Tue Feb 26 21:31:02 2008
From: tampo_8 at yahoo.com (=?iso-8859-1?Q?S=E9rgio_Medeiros?=)
Date: Tue Feb 26 21:34:02 2008
Subject: Res: [Sputnik-list] Permissions
Message-ID: <915756.55992.qm@web54112.mail.re2.yahoo.com>

Hi!

It was more difficult than I imagined, but I think
we are almost there about Subversion + Sputnik :-)

Well, I was working in a different computer today and
after several hours seeing an error that I was not understanding,
I finally concluded that a small change is necessary in "wiki.lua".

When trying to edit a page, I was getting 'honeypot numbers' like
"1,321836689637" instead of ""1.321836689637", a comma instead
of a dot.

But this was just happening when I was using Subversion, when I was
working with LFS everything was going fine (Oh, I spent many hours
on this :-))

In line 462, I changed "order = tostring(math.random()*5)," to
"order = string.gsub (tostring(math.random()*5), ",", "."),".
I think this error is because the locale, as in Brazil is common
to write a "," instead of a "." when representing a float point
number.

Yuri, I also changed the function "get_node_exists", I think
it was not returning a boolean value as the description of
the function indicated.

I did not implement the "extra" metadata of an index entry.
After some time, I think I understood the code in "simple.lua",
but I am wondering if it is a little too specific.

About the installation, you don't need to "checkout" the
working copy when you create the repository, "SVNVersiumStorage:new"
always do this (don't know if it's the best option, but
seems reasonable). 

But about the "Create repository" step, maybe would
be better if Sputnik checked if the repository exists 
instead of Versium. When using LFS, wiki-data is created by

the Sputnik script, not by Versium.


I did not understand why you prefer 
"luarocks 
install 
versium-svn" 
instead of just ""luarocks 
install luasvn".
What would be the benefits?

I hope I have not been too prolix :-)


Sergio


----- Mensagem original ----
De: Yuri Takhteyev <yuri@sims.berkeley.edu>
Para: S?rgio Medeiros <tampo_8@yahoo.com>
Cc: Sputnik <sputnik-list@lists.luaforge.net>
Enviadas: Ter?a-feira, 26 de Fevereiro de 2008 5:22:57
Assunto: Re: [Sputnik-list] Permissions

Indeed 
it 
works!  
Nice!

I've 
been 
thinking 
of 
making 
it 
into 
a 
rock 
of 
it's 
own
("versium-svn") 
which 
would 
then 
specify 
a 
dependency 
on 
luasvn.  
Then
to 
install 
it 
one 
would 
just 
need 
to 
do 
"luarocks 
install 
versium-svn"
and 
luasvn 
would 
get 
installed 
automatically.  
What 
do 
you 
think?

Also, 
about 
the 
"Create 
a 
repository" 
step.  
Would 
it 
be 
possible 
to
wrap 
this 
into 
the 
module 
somehow?  
I.e., 
check 
if 
the 
repository
exists 
and 
if 
it 
doesn't 
create 
it?  
Alternatively, 
those 
four 
lines
could 
just 
be 
put 
into 
a 
small 
script 
that 
could 
be 
put 
into 
the 
bin
directory 
as 
a 
part 
of 
the 
installation, 
so 
that 
the 
first 
two 
steps
in 
the 
installation 
would 
be:

  
  
luarocks 
install 
versium-svn
  
  
./bin/lua5.1 
./bin/luasvn_init_repository.lua 
my_repos 
wiki-data

Oh, 
there 
is 
also 
a 
small 
problem: 
I 
can't 
create 
new 
nodes. 
:(

Sputnik 
ran 
but 
failed 
due 
to 
an 
unexpected 
error.

stack 
traceback:
    
...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:451: 
in 
function 
'err'
    
/home/yuri/sputnik/share/lua/5.1/coxpcall.lua:24: 
in 
function
    
(tail 
call): 
?
    
(tail 
call): 
?
    
(tail 
call): 
?
    
...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:454: 
in
function 
'protected_run'
    
...sputnik/rocks/sputnik/8.02.20-0/lua/sputnik/init.lua:528: 
in
function 
'cgilua_run'
    
sputnik.lua:11: 
in 
main 
chunk


I 
haven't 
had 
a 
chance 
to 
debug 
it, 
but 
I 
am 
guessing 
that 
somehow
node_exists() 
returns 
true 
and 
versium 
then 
tries 
to 
actually 
read 
the
file.  
But 
for 
files 
that 
are 
created 
programmatically 
(all 
the
initial 
pages), 
I 
can 
edit 
them 
successfully.

Thanks 
for 
the 
work!

>  
I 
tried 
to 
follow 
your 
instructions, 
assuming 
I 
have 
installed
>  
Sputnik 
using 
the 
script 
"sputnik_install_2008_02_16.sh".

Sorry 
for 
the 
confusing 
instructions, 
but 
I 
suppose 
they 
are 
moot 
now.

 
- 
yuri

--
http://www.freewisdom.org/en/pipa/albums/





      Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento!
http://br.mail.yahoo.com/


From yuri at sims.berkeley.edu  Tue Feb 26 22:47:56 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Tue Feb 26 22:50:28 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <915756.55992.qm@web54112.mail.re2.yahoo.com>
References: <915756.55992.qm@web54112.mail.re2.yahoo.com>
Message-ID: <fa4efbc00802261647v58f775uc7c054a14d6bcfda@mail.gmail.com>

>  In line 462, I changed "order = tostring(math.random()*5)," to
>  "order = string.gsub (tostring(math.random()*5), ",", "."),".
>  I think this error is because the locale, as in Brazil is common
>  to write a "," instead of a "." when representing a float point
>  number.

Ouch.  I am glad you managed to track this down.  But I am wondering
if this is the best way to fix it.  Does Lua have some sort of
local-independent version of to_string that would be appropriate for
converting numbers to stings to dostring them later?

BTW, I apologize for the magic number "5" in there.  The worst part is
that it took me a while to remember what it stands for...  So, really,
I think this should be:

order= local_independent_tostring(math.random()*max_order)

where max_order = the maximum order value among the "real" fields

BTW, what this all is for is to put honeypot fields in random
positions.  Basically, each field definition has a parameter called
"order" which use used to order the fields.  This helps if you want to
insert a custom field at a specific position:

E.g. @Root says:

edit_ui = [[
...
page_params_hdr = {1.0, "header"}
page_name       = {1.1, "readonly_text"}
title           = {1.2, "text_field"}
show_advanced   = {2.0, "show_advanced", no_label=true}
category        = {2.1, "text_field", advanced=true}
...
content         = {3.1, "big_textarea", rows=27,  no_label=true}
...
]]

For the "tickets" plugin, we want to insert a bunch of custom fields
between "permissions" and "content".  We do this with:

edit_ui= [[reported_by = {1.31, "text_field"}
severity    = {1.32, "select", options={"unassigned", "show stopper",
"annoying", "cosmetic"}}
priority    = {1.33, "select", options={"unassigned", "highest",
"high", "medium", "low", "lowest"}}
status      = {1.34, "select", options={"new", "confirmed",
"assigned", "fixed", "tested", "wontfix"}}
...
]]

Note that those fields will show up between "Title" and all the
"Advanced" fields because their "order" falls in between 1.2 ("title")
and 1.3 ("advanced_fields").

>  But about the "Create repository" step, maybe would
>  be better if Sputnik checked if the repository exists
>  instead of Versium. When using LFS, wiki-data is created by
>  the Sputnik script, not by Versium.

Well, I don't want Sputnik to have to know that it's using one or the
other storage implementation.  Note that with storage.simple, the
wiki-data directory is created by the sputnik _installation script_
not by Sputnik itself.

In other words, I think versium storage implementations should ideally
be able to initialize themselves upon first use, but if they can't,
the user should be instructed to perform some sort
implementation-specific installation steps, which would ideally just
involve running a script.  In either case, though, Sputnik assumes
that the storage implementation is either ready to go or will
initialize itself when called the first time.

The reason versium.storage.simple doesn't create the directory is
because Sputnik might not always have permissions to do that.  The
installation script is presumably being run by the user who is allowed
to create directories and can set permissions on that directory to
make it writeable by the server.  I am guessing the same logic might
apply to the svn implementation, so maybe making a simple
initialization script is the way to go.

>  I did not understand why you prefer "luarock install versium-svn"
>  instead of just ""luarocks install luasvn".
>  What would be the benefits?

It's was meant as question really.  But I think it would make plugins
easier to understand.  Basically, if you want to install a versium
plugin X, you do "luarocks install versium-x".  I.e.: "luarocks
install versium-svn", "luarocks install versium-sqlite", "luarocks
install versium-s3", etc.  It would always be one rock which would
pull whatever else it needs.  If we say that to install the SVN plugin
you need to install "luasvn" and assume that versium.storage.svn is
already there, then this leaves you wondering what you need to install
for versium.storage.sqlite.  Do you need luasql?  Is
"versium.storage.sqlite" included? Etc.  Plus this makes it easy to
know when and what to upgrade.  E.g., you would know to ignore any new
releases of "versium-sqlite".  But again, it's a question.  Do you
think I am being a decomposition freak?

- yuri


From pierre.pracht at gmail.com  Thu Feb 28 09:06:28 2008
From: pierre.pracht at gmail.com (pierre pracht)
Date: Thu Feb 28 09:09:09 2008
Subject: Res: [Sputnik-list] Permissions
In-Reply-To: <265342.41656.qm@web54109.mail.re2.yahoo.com>
References: <265342.41656.qm@web54109.mail.re2.yahoo.com>
Message-ID: <AFE22FD9-887C-4A89-B4D0-4E539E652B2E@gmail.com>


Le 26 f?vr. 08 ? 01:31, S?rgio Medeiros a ?crit :

>> I managed to get half-way there with this module.  Here is what I  
>> did:
>> http://sputnik.freewisdom.org/en/With_SVN  Then I got an error
>> message.  Any suggestions?
>
> I tried to follow your instructions, assuming I have installed
> Sputnik using the script "sputnik_install_2008_02_16.sh".
>
>> Get the latest revision from Sputnik's subversion
>> svn update rocks/versium
>
> This was a little bit confusing, because does not do anything.

In my setup, versium from svn isn't working :
I have previously send a patch for this to Yuri.
I can commit some change to the repository but I'm reluctant due to  
change spreading in all sputnik.

Yuri : can you confirm the intended change to object notation in  
luaenv.lua ?

I really need a working svn copy.
I can make a branch in the mean time but lasts versions (tags ?) are  
in branches and some extra document are in trunk.

Any advice ? I would like to help but I can't change what didn't  
belong to me.

- pierre

From mmburke at gwu.edu  Wed May 21 00:27:04 2008
From: mmburke at gwu.edu (Matthew M. Burke)
Date: Wed May 21 00:34:05 2008
Subject: [Sputnik-list] Permissions
Message-ID: <48338878.9090100@gwu.edu>

Next  problem:

I read 
http://lists.luaforge.net/pipermail/sputnik-list/2008-February/000133.html 
regarding Sputnik's permission language.

I'd like to essentially make my wiki world-readable and close off the 
ability to create or edit pages.  So I've tried

permissions= [=[
      deny(all, "save")
      allow("Admin", "save")
]=]


in several likely candidates (@Root, Home_Page) but that doesn't stop me 
from being able to use any account (or create a new account) and create 
pages, edit pages, etc.

I'm using rock 8.02.20-0

Matt



From yuri at sims.berkeley.edu  Wed May 21 00:54:52 2008
From: yuri at sims.berkeley.edu (Yuri Takhteyev)
Date: Wed May 21 01:01:55 2008
Subject: [Sputnik-list] Permissions
In-Reply-To: <48338878.9090100@gwu.edu>
References: <48338878.9090100@gwu.edu>
Message-ID: <fa4efbc00805201954gbf56e9bh9eac2a899e3228e3@mail.gmail.com>

> permissions= [=[
>     deny(all, "save")
>     allow("Admin", "save")
> ]=]
>
>
> in several likely candidates (@Root, Home_Page) but that doesn't stop me
> from being able to use any account (or create a new account) and create
> pages, edit pages, etc.

Doing this in a page like Home_Page _should_ do the trick for that
page, and adding this to @Root should do it for all pages.  Note that
in the version that you are using, you will still be able to _edit_
those pages, you just won't be able to save them.  This has been
changed in the newer version, which will give you a message when you
are trying to _edit_.

I am not sure why this doesn't work.   I just tried it on the Sputnik
website and it seemed to work: http://sputnik.freewisdom.org/en/Locked

Just to clarify: permissions = [=[.... ]=] does not mean that you
should put that into the body of the page.  It means that you should
add

     deny(all, "save")
     allow("Admin", "save")

to the "permissions" field in the edit UI.  (You would write
"permissions = [=[...]=]"  only if you are editing the node by hand in
vi or something like that.)

Again, the new version extends the permission system a bit, see
http://gitorious.org/projects/sputnik/repos/mainline/commits/db441bd70

 - yuri

-- 
http://sputnik.freewisdom.org/
Powered by Sputnik | XHTML 1.1