Author Topic: Feature request: folder access by IP address  (Read 1944 times)

0 Members and 1 Guest are viewing this topic.

Offline morituruz

  • Occasional poster
  • *
  • Posts: 3
    • View Profile
Feature request: folder access by IP address
« on: December 01, 2016, 02:49:11 AM »
Hello and thanks for this great software  :)
I know about User Accounts but i need more «simple» solution.
Example: i want to allow users from my LAN (10.0.0.0/24) to access some folder in HFS, and hide this folder from others.

Offline bmartino1

  • Insane poster
  • *****
  • Posts: 758
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: Feature request: folder access by IP address
« Reply #1 on: December 01, 2016, 09:31:45 AM »
i belive this can be doen with the macros and the template in hfs

http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands

other wise, maybe some html programing, it seems to be a 301 redirect
http://stackoverflow.com/questions/8985502/htaccess-redirect-to-all-ips-but-mine
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline dj

  • Experienced poster
  • ***
  • Posts: 51
    • View Profile
Re: Feature request: folder access by IP address
« Reply #2 on: December 02, 2016, 08:36:43 AM »
Change ip and Add diff template
Code: [Select]
[list]
{.if |{.%ip%=192.168.1.2.}|

<div id='files_outer'>
<div style='height:1.6em;'></div> {.comment| this is quite ugly, i know, but if i use any vertical padding with height:100% i'll get a scrollbar .}
{.if not| %number% |{: <div style='font-size:200%; padding:1em;'>{.!No {.if|{.length|{.?search.}.}|results|files.}.}</div> :}|{:
        <form method='post'>
            <table id='files'>
            {.set|sortlink| {:<a href="{.trim|
                    {.get|url|sort=$1| {.if| {.{.?sort.} = $1.} |  rev={.not|{.?rev.} .} /if.} /get.}
                /trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}arr;.}</a>:} .}
            <th>{.^sortlink|n|Name.}{.^sortlink|e|.extension.}
            <th>{.^sortlink|s|Size.}
            <th>{.^sortlink|t|Timestamp.}
            <th>{.^sortlink|d|Hits.}
            %list%
            </table>
        </form>
:}.}
</div>

|forbidden.}

update for your case:
{.if |{.regexp|10\.0\.0\.|%ip%.}|
or {.if |{.{.regexp|.*\.|%host%.}={.regexp|.*\.|%ip%.}.}| or {.if |{.match|10.0.0.*|%ip%.}|
« Last Edit: December 04, 2016, 05:14:20 AM by dj »

Offline morituruz

  • Occasional poster
  • *
  • Posts: 3
    • View Profile
Re: Feature request: folder access by IP address
« Reply #3 on: December 11, 2017, 04:25:19 AM »
So year later i discovered that i received a pretty good reply :D
Thank you very much!

Actually i need to deny download of *.html files so now I have that code in hfs.events:
Code: [Select]
[request]
{.if
| {.and
| {.not
| {.or
| {.match | 127.0.0.1 | %ip% .}
| {.match | 10.0.*.* | %ip% .}
.}
.}
| {.match | */some_url_path/* | %url% .}
.}
|
{:{.disconnection reason| IP: %ip%.}:}
.}

Surprisingly wiki page http://www.rejetto.com/wiki/?title=HFS:_Event_scripts does not exist anymore.
« Last Edit: December 11, 2017, 07:56:05 AM by morituruz »

Follow members gave a thank to your post:


Offline LeoNeeson

  • Insane poster
  • *****
  • Posts: 441
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Feature request: folder access by IP address
« Reply #4 on: December 11, 2017, 05:05:44 AM »
Cool! :)

Fortunately, Archive.org still has a copy of it.
• HFS ahora también disponible en Español! (Clic aqui) :)
• HFS is now also available in Spanish! (Click here)

Offline morituruz

  • Occasional poster
  • *
  • Posts: 3
    • View Profile
Re: Feature request: folder access by IP address
« Reply #5 on: December 11, 2017, 06:00:52 AM »
Thanks to the wiki engine nothing was actually deleted :)
http://www.rejetto.com/wiki/index.php?title=HFS:_Event_scripts&oldid=5612

Offline LeoNeeson

  • Insane poster
  • *****
  • Posts: 441
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Feature request: folder access by IP address
« Reply #6 on: December 11, 2017, 07:40:46 PM »
Hi rejetto, please check your Wiki, since it seems there is a problem with it because I can't login. It shows this error: "There seems to be a problem with your login session; this action has been cancelled as a precaution against session hijacking. Go back to the previous page, reload that page and then try again.". I've tried to login with another browser, but it shows the same error.

See the screenshot: https://i.imgur.com/erYmd81.png


Searching on Google, here, here and here you can find a possible solution (it seems you have to change $wgMainCacheType = CACHE_ACCEL; to $wgMainCacheType = CACHE_NONE; or changing it to $wgSessionCacheType = CACHE_DB; in the cache settings file, located in LocalSettings.php)

Cheers,
Leo.-
« Last Edit: December 11, 2017, 07:45:02 PM by LeoNeeson »
• HFS ahora también disponible en Español! (Clic aqui) :)
• HFS is now also available in Spanish! (Click here)