rejetto forum

Premium hour / Folder lock

Kremlin · 14 · 4462

0 Members and 1 Guest are viewing this topic.

Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Hi everyone, it's been a while :) (University..)

So basically i'm trying to figure out how to enforce a premium hour service, as in some folders get automatically locked at a certain time in the day lets say [at 19:00]. These folders should preferably get locked with an already existing account user and pass (this part if flexible). Is there anyway to do so in the 'diff template' sections with the 'if' 'set ini' and 'at' macros? Other suggestions are also welcome.

PS. I do not wish to lock the entire site, just the folders that appear in the site.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
with diff templates you may get to hide the files, not showing the list on some hours.
but the best solution is: events + account


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
hmm, when i use set user/pass on a folder with the interface option, is there a way to put that action in form of a macro in the diff template?

I would then use something like,

[at 18:00]
{.set ini|%user%=xxxx ...


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
hmm, when i use set user/pass on a folder with the interface option, is there a way to put that action in form of a macro in the diff template?

I would then use something like,

[at 18:00]
{.set ini|%user%=xxxx ...

events as [at 18:00] are only allowed in hfs.events, not inside a tpl or a diff tpl

time events are tested every minutes

Quote from: WIKI Rejetto
Timed events
You can ask HFS to run a script at a certain time, or interval.

To run a script at 1PM o'clock, you can make an event [at 13:00].

To run every 15 minutes instead you should make an event [every 15 minutes].


scripts and events in hfs
http://www.rejetto.com/forum/index.php?topic=6588.msg1042304#msg1042304

Small reminder about EVENTS and hfs.events
http://www.rejetto.com/forum/index.php?topic=6845.msg1042396#msg1042396


but you know all of that ;)


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Yeah, I kinda figured that the [at xx:xx] would only work for the events, but with this comes an idea, how about adding an option to the events to only affect certain folders in the hfs tree. For example:

[for /Movies/2009/]
[at 18:00]
{.set ...
[/for]

this way we could use the events in a partial way. Anyway it's just a suggestion for rejetto  :P


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
[for /Movies/2009/]
[at 18:00]
{.set ...
[/for]


[at 18:00]
{set item|/Movies/2009|remove access=Kremlin.}

[at 06:00]
{set item|/Movies/2009|add access=Kremlin.}



Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Yet something is missing in a little script i'm making

Code: [Select]
[unauthorized]
{.if|%password%=||{.append|/template/log.txt|[%date][%ip%] %user%:%password%
.}.}

Keep in mind when i place nothing in front of the =, i mean it not to log when someone has not entered a password. But it still keeps logging it, making the number of lines in the txt file massive :S
« Last Edit: October 29, 2009, 11:07:10 PM by Kremlin »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
[unauthorized]
{.if|%password%=||{.append|/template/log.txt|[%date][%ip%] %user%:%password%
.}.}

exactly the same with

[unauthorized]
{.if|%user%%password%|{:{.append|/template/log.txt|
[%date%] [%ip%] %user%:%password%.}:}.}

never forget to quote any macro inside {.if| .... |{: .... :}|{: .... :} .}

« Last Edit: October 29, 2009, 11:36:22 PM by Mars »


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Figured it out, just bad syntax  :P

Code: [Select]
[unauthorized]
{.if not|{.%password%=.}|{:{.append|/template/log.txt|[%date][%ip] %user%:%password%
.}:}.}

Works like a charm  :)
« Last Edit: October 29, 2009, 11:59:16 PM by Kremlin »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
you can reduce
{.if not|{.%password%=.}|{:{.

by
{.if|%password%|{:{.



Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Just to conclude the purpose of this thread and if anyone else is interested in something similar, I chose these lines to use in the hfs.events (ALT+F6)

Code: [Select]
[at 18:00]
{.set ini|speed-limit-ip=5.}
{.set item|/|add access=Administrator.}

[at 18:01]
{.disconnect|192.168.12.1-192.168.12.255.}

[at 00:00]
{.set ini|speed-limit-ip=-1.}
{.set item|/|remove access=Administrator.}

Obviously the 'Administrator' account needs the no limits option, otherwise speed would be very slow :P