From valebedev at gmail.com Wed Dec 17 07:38:56 2008 From: valebedev at gmail.com (Vladimir Lebedev) Date: Wed Dec 17 06:46:01 2008 Subject: [Sputnik-list] How to attach a binary file to a node? In-Reply-To: 2650059.2061228204582629.JavaMail.wal@macpro-wal.local Message-ID: 13419635.931229506734810.JavaMail.wal@macpro-wal.local
Is there a way to attach a binary file to a node? Basically, I need to attach .pdf or .doc/.odt files to some pages in my wiki. I read a thread on it in maillist archive (March'08), but truly speaking I did not understand if such feature was implemented or not...
----- ???????? ????????? ----- ??: "Vladimir Lebedev" valebedev@gmail.com ????: "Yuri Takhteyev" yuri@sims.berkeley.edu ?????: sputnik-list@lists.luaforge.net ????????????: ???????, 2 ??????? 2008 ? 10:56:26 GMT +03:00 ??????, ?????-?????????, ????????? ????: Re: [Sputnik-list] HTTP-auth for Sputnik
Dear Yuri,
Thanks a lot for your help! I put "$ifloggedin" in a couple more places in sputnik/template and now it seems to be OK for the beginning.
I'm not sure that I'll be able to write a new authentication plugin - I quit my programming carrier more then 15 years ago... Though if I try, I'll let you know! :)
Best regards, Vladimir
----- ???????? ????????? ----- ??: "Yuri Takhteyev" yuri@sims.berkeley.edu ????: "Vladimir Lebedev" valebedev@gmail.com ?????: sputnik-list@lists.luaforge.net ????????????: ???????????, 1 ??????? 2008 ? 22:07:26 GMT +03:00 ??????, ?????-?????????, ????????? ????: Re: [Sputnik-list] HTTP-auth for Sputnik
I can suggest three options. First, you can definitely simply put Sputnik behind http authentication, as you would with any site. Your users will need to then do http authentication before they see anything. Sputnik wouldn't know whether they actually authenticated and who they are logged in as, but this may not matter. This is also by far the most secure way to protect your Sputnik.
Another alternative is to use Sputnik authentication, but change it to really limit what information is displayed to non-authenticated users. You can edit permissions in @Root and prohibit nearly all actions to non-authenticated users (just comment out most of the options there), leaving just enough to allow them to login. You can also hide the navigation bar quite easily for users who are not logged in by editing sputnik/templates node and changing
$donavsections[=[
<li class='$class' id='$id'>
<a $link>$title</a>
<ul class='$class'> <!-- ul.back will be hidden via CSS -->
$subsections[[<li class='$class'><a $link>$title</a></li>]]
<li style="display:none"> </li>
</ul>
</li>]=]
to
$ifloggedin[======[ $donavsections[=[
<li class='$class' id='$id'>
<a $link>$title</a>
<ul class='$class'> <!-- ul.back will be hidden via CSS -->
$subsections[[<li class='$class'><a $link>$title</a></li>]]
<li style="display:none"> </li>
</ul>
</li>]=]
]======]
Finally, it should be possible to change sputnik to actually pick up authentication information from the headers. The less elegant way to do this would be to edit Sputnik:translate_request () in sputnik/lua/sputnik/init.lua to look at HTTP headers and set request.user as you like. A better way of doing this would be to write an a new authentication module using sputnik/lua/sputnik/auth/simple.lua as an example. (The authentication API would need to be extended a little bit to allow passing the headers.)
- yuri
On Mon, Dec 1, 2008 at 10:02 AM, Vladimir Lebedev valebedev@gmail.com wrote:
Dear all,
Is it possible to authenticate an user via simple http authentication? I need this in order to conceal both content and structure of my wiki from anonymous visitors.
Thank you very much in advance,
Vladimir
Sputnik-list mailing list Sputnik-list@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/sputnik-list
-- http://sputnik.freewisdom.org/
From yuri at sims.berkeley.edu Wed Dec 17 08:02:01 2008 From: yuri at sims.berkeley.edu (Yuri Takhteyev) Date: Wed Dec 17 07:08:23 2008 Subject: [Sputnik-list] How to attach a binary file to a node? In-Reply-To: 13419635.931229506734810.JavaMail.wal@macpro-wal.local References: 2650059.2061228204582629.JavaMail.wal@macpro-wal.local
<13419635.931229506734810.JavaMail.wal@macpro-wal.local>
Message-ID: fa4efbc00812170202w6d873399y4ead3240df1b7b57@mail.gmail.com
Is there a way to attach a binary file to a node? Basically, I need to attach .pdf or .doc/.odt files to some pages in my wiki. I read a thread on it in maillist archive (March'08), but truly speaking I did not understand if such feature was implemented or not...
You cannot "attach" a binary file to a node, but you can make a node represent a binary file. You do this by choosing the appropriate prototype, which in this case is "@Binary_File".
Go to a new node, e.g. "Test" and click "edit". Go to "Advanced Options" and put "@Binary_File" in "Prototype". Click "save". You will then see a different edit form, which will allow you to upload a file. ("File to upload".) Save again. You pdf file will now available as "Test.download". If you upload an image, you can also link to it as Test.jpg (or Test.png, depending on the format). For instance, http://sputnik.freewisdom.org/en/logo.png is a node. To see it as a node, just go to http://sputnik.freewisdom.org/en/logo.
If you want to make it look like the binary file "belongs" to some node, you can make it a child of that node. E.g., if you have a node called "Test", you can call your binary node "Test/PDFVersion" and link to it as "Test/PDFVersion.download". You can do this to many binary files if you want: "Test/A", "Test/B", etc.
- yuri
-- http://sputnik.freewisdom.org/
From valebedev at gmail.com Wed Dec 17 08:13:02 2008 From: valebedev at gmail.com (Vladimir Lebedev) Date: Wed Dec 17 07:19:53 2008 Subject: [Sputnik-list] How to attach a binary file to a node? In-Reply-To: fa4efbc00812170202w6d873399y4ead3240df1b7b57@mail.gmail.com Message-ID: 12164074.1031229508778970.JavaMail.wal@macpro-wal.local
Great, thanks a lot! I think it worth to put this description on the sputnik's web site.
----- ???????? ????????? ----- ??: "Yuri Takhteyev" yuri@sims.berkeley.edu ????: "Vladimir Lebedev" valebedev@gmail.com ?????: sputnik-list@lists.luaforge.net ????????????: ?????, 17 ??????? 2008 ? 13:02:01 GMT +03:00 ??????, ?????-?????????, ????????? ????: Re: [Sputnik-list] How to attach a binary file to a node?
Is there a way to attach a binary file to a node? Basically, I need to attach .pdf or .doc/.odt files to some pages in my wiki. I read a thread on it in maillist archive (March'08), but truly speaking I did not understand if such feature was implemented or not...
You cannot "attach" a binary file to a node, but you can make a node represent a binary file. You do this by choosing the appropriate prototype, which in this case is "@Binary_File".
Go to a new node, e.g. "Test" and click "edit". Go to "Advanced Options" and put "@Binary_File" in "Prototype". Click "save". You will then see a different edit form, which will allow you to upload a file. ("File to upload".) Save again. You pdf file will now available as "Test.download". If you upload an image, you can also link to it as Test.jpg (or Test.png, depending on the format). For instance, http://sputnik.freewisdom.org/en/logo.png is a node. To see it as a node, just go to http://sputnik.freewisdom.org/en/logo.
If you want to make it look like the binary file "belongs" to some node, you can make it a child of that node. E.g., if you have a node called "Test", you can call your binary node "Test/PDFVersion" and link to it as "Test/PDFVersion.download". You can do this to many binary files if you want: "Test/A", "Test/B", etc.
- yuri
-- http://sputnik.freewisdom.org/