rejetto forum

new users

CJ · 20 · 6377

0 Members and 1 Guest are viewing this topic.

Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
OK, first of all, I think HFS is one of the BEST programs that I have seen in my life! It's much friendlier than using FTP and the options provided for such a small executable are amazing!  However, my problem is that I am setting this up for a number of new users and scripting is something that I never really got into.  

I just need 2 VERY small scripts that will 1) move a bunch of real folders and user accounts already created to another folder on the hard drive AND
2) a script that will allow me to (one-at-a-time is fine) create new users, set their passwords, create the folder on the hard drive and associate it with the new user as a real folder, and allow downloads ONLY for the account just created, and provide uploads AND downloads ONLY for the admin as I am creating them.  

If it is possible to write a script that will give upload AND download rights ONLY to the admin for ALL of the existing folders after everything else is done, that would be fine, too.  

Sorry to be a pain about this, but it seems like the only viable solution for what I am doing as every user needs to access ONLY their folder (and ONLY for downloads) and NOBODY else's, but the admin has to be able to upload and download to EVERYBODY'S folder and NOBODY else can access the admin's account.  I understand that this would probably be a very simple thing to do using scripting instead of the gui.  

I have already inputed over 100 users using the gui because I didn't know how to script and I can't tell you how many hours it took.  Having a script that could do this, even if I had to input each one one-at-a-time would be better than creating folders in XP, creating users and thier passwords one-at-a-time in the gui, and then going back through the gui to associate them all and only using the browse folder, and then, when I am finished, going to each one and setting the download permissions for each and then setting  the upload AND download permissions for the admin.  

If anybody can help, I would GREATLY appreciate it!  My job is riding on this and I didn't think that it would be this involved when I started.  They just kind of dropped on me what the magnitude of this whole thing was going to be after I started.  Much thanks to anybody that can help me with this little problem!
« Last Edit: July 28, 2010, 12:11:30 PM by CJ »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
1. no need for a script. To move the folders, just select them all in the virtual file system, then move them.
accounts don't need to be moved, they are bound to the folders.

2. solutions are many.
this is the first that comes to my mind.
create a virtual folder, then right click > properties > diff template
and put this text

Code: [Select]
{.disconnection reason|Please create "admin" account first|if={.not|{.get account|admin|exists.}.}.}
{.trim|
{.if not|{.and|{.?usr.}|{.?pwd.}.}|
    <form>
    username <input name='usr'>
    <p>password <input name='pwd'>
    <p><input type='submit'>
    </form>
|{:
    {.add folder|real|C:\spaces|/spaces.}
    {.set|src|C:\spaces\{.?usr.}.}
    {.set|dst|/spaces/{.?usr.}.}
   
    {.if|{.exists|{.^dst.}.}| the folder already exists
    |{:   
        {.new account|{.?usr.}|password={.?pwd.}|enabled=1|redirect={.^dst.}.}
        {.mkdir|{.^src.}.}
        {.add folder|real|{.^src.}|{.^dst.}.}
        {.set item|{.^dst.}|access=admin;{.?usr.}|upload=admin.}
        Fatto
    :}/if.}
:}/if not.}

/trim.}


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
wow, i got the admin's attention!  now i feel special!  :) thank you rejetto for an absolutely awesome piece of software!

the problem is that i have already created over 150 users, all using real folders, and now i am being told that i have to add almost 400 more! on top of that, they apparently have to be divided into groups. 

so now, i have to take all of the ones that i created and put them in one group, but they have to stay linked to their real folders, but now i am going to put all of the real folders into another folder on c:\ (i really wish they told me what they wanted before i started :( ), so basically, they are ALL now going to be child folders in a parent folder. 

i won't make the same mistake again, which is why all of the new ones i have to input are just going to be configured corectly in their own groups to begin with.  a script asking for group name, folder name (which is actually the same name as the user account name), user account and p/w, association to said folder, and download rights only would be freakin sweet. 

i can just make a batch file to actually create the files from a DOS prompt, so no problem there.

but, ALL of them need to be real folders somewhere on c:\ 

also, it would help to hide the admin folder from everybody EXCEPT the admin...or at least provide a link to it, but that's not a problem...that's the kind of stuff i can figure out with a shortcut or bookmark. 

i know i am asking a lot, but as long as a can get this working, a donation is on it's way as soon as i get paid!

if everything i'm saying is a little confusing, let me know and i can clarify.

Thanks again for all the help! :)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
so now, i have to take all of the ones that i created and put them in one group,

quickest way:
create the group, let's say "group1",
save options to file,
edit your hfs.ini with a text editor
use the replace command to replace "enabled:yes|" with "enabled:yes|link:group1|"  (don't include quotes).
save, and restart hfs.
not tested but it should work.
making a script for this would be much more complicated then doing it manually this way.

Quote
but they have to stay linked to their real folders, but now i am going to put all of the real folders into another folder on c:\ (i really wish they told me what they wanted before i started :( ), so basically, they are ALL now going to be child folders in a parent folder. 

ah, this problem was easily solved if the VFS format was xml-based.
i'm going to note this down for the future.
2 solutions come quickly to my mind.
one is a script that applies the change to the items, but it's not feasable at the moment, as it would require some not available features.
the other is to completely change system.
you are creating many folders in the virtual file system to control access over them. But you can use events to obtain the same effect.
0. trash all the real folders you created since now (remember to backup the vfs first :P)
1. create a single real folder, that's the parent folder that will hold all users' subfolders.
2. give upload permission to the admin account for this folder.
3. use an event script to detect access to subfolders, and require to be logged in with the related account.


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
sounds like a plan. thank you so much for looking into this!  so how would you suggest that i proceed for all of the other users that i have to add?  just a prompt type interface would be fine.

something that asks for user name (then assigns the user account to the real folder of the same name), p/w, which group it belongs to, and after creation, grants download rights to ONLY that user for ONLY that folder. 

i could just input them one at a time...tedious...but some jobs are easier with a prompt than with a gui. 

thanks again for all of your help!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
you got me wrong.
the way i say, there's no real folder to be created.
just create the folder on disk inside the parent folder, and the account in HFS (press F7).
let's say the parent folder is named "spaces". Press ALT+F6 and add this script

[+request]
{.set|required| {.regexp|/spaces/([^/]+)|%url%.} .}
{.disconnection reason|You are required to login, <a href='./~login'>click here</a>
|if={.and|{.^required.}|{.match|\.*/~login|%url%.}|{.%user% != {.^required.}.}/and.} .}


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
understood, however the folders HAVE to be real because files are being added, deleted, and changed directly to the HFS box through the network in the office using windows explorer.  the new user accounts have to be added as the files are created and moved to the HFS box. 

the physical folder creation is nothing more than a DOS batch file.  the association with the users accounts on HFS however, is a fairly simple, yet tedious, procedure. 

the way it is supposed to be set up is the user account in HFS is the same name as the physical folder name in windows (just for simplicity's sake).  the password, group association, and download privledges are what need to be set in a repetitive way.

example: john, mike, joe, frank, and bob are all users to be set up.  a script to quickly set up these users one after another is what's needed.  keep in mind, the physical folders are already created and populated with their respective files in windows...

input user name-->"john", add to HFS VFS, create user account, and associate with real folder-->"c:\john", what's "john's" p/w-->"some p/w", what group is john going to be in-->"some group", and then assign "john" with download only rights while not letting mike, joe, frank, or bob into his folder and then repeating the whole process in a batch style for mike, joe, frank, and bob, etc... then asking if another user needs to be added after each one is completed. 

when all is said and done, giving ONLY the admin rights to upload and download to ALL acounts, but make admin account and folders hidden from everybody else.

i know that this sounds like a very drawn-out process and it is with over 500 accounts to input.  thank you for all of your help! :D
« Last Edit: July 30, 2010, 02:33:29 PM by CJ »


Offline Dragon_Hunter

  • Occasional poster
  • *
    • Posts: 52
    • View Profile
Even if you put the folder as a virtual, then there is no uppload button. and if you have the folder as real then there is upload button


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
fair enough, but it's still a matter of having a script that will add SEVERAL new user accounts and their credentials to HFS and the accompanying folders on the system.


Offline r][m

  • Tireless poster
  • ****
    • Posts: 347
    • View Profile
On testing the posted script I notice that when admin logs in
upload is available only in the last folder/account created.
It is not there for previous ones. Is that expected?
Anyone else confirm?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
understood, however the folders HAVE to be real because files are being added, deleted, and changed directly to the HFS box through the network in the office using windows explorer. 
the new user accounts have to be added as the files are created and moved to the HFS box. 

mmm, i don't understand what you said. Maybe you meant "internet explorer" ?
What i have said is that you don't have to make any folder in hfs (except the main one), but just on the disk.
Being the main one a real folder, users will access subfolders too.

Quote
the physical folder creation is nothing more than a DOS batch file.  the association with the users accounts on HFS however, is a fairly simple, yet tedious, procedure. 

in my solution the association is automatic.
actually, there's NO association, it's the script that enforces the rule: access to folder = same user logged in.

The first script is for a different solution. In this one, you only need the second script.

i think i was not clear before.
reconsider my suggestion.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
On testing the posted script I notice that when admin logs in
upload is available only in the last folder/account created.
It is not there for previous ones. Is that expected?
Anyone else confirm?

yes, the FIRST script i posted is not "fixing" previous things. They were supposed to be already working.


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
so the second script will allow me to do what i need?  the moving folders part for the ones already created will be (using previous example) from "c:\john" to "c:\hfs\john" while still maintaining the user account (name and p/w) for when i originally set it up for "c:\john"? so basically, HFS will be going to "c:\hfs" instead of just "c:\" to find "john's" folder?

and it will also ONLY allow the user account that i just created to ONLY access their own folder (ex. john can access ONLY "c:\hfs\john" but not "c:\hfs\frank" or anyone else...likewise for frank to ONLY access "c:\hfs\frank" but not john or anyone else, etc.?

also, no i DID mean windows explorer..."my computer (right-click)--> explore--> (when list comes up, left pane) my network places--> file server (HFS box)" is how they are accessing it from the office network (not dealing with people who know a lot about this stuff :) )


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13516
    • View Profile
the moving folders part for the ones already created will be (using previous example) from "c:\john" to "c:\hfs\john"

you won't move anything.
Now that the we made the idea clearer, you should re-read what i wrote you when it was not clear.
http://www.rejetto.com/forum/index.php/topic,8831.msg1051061.html#msg1051061
At step 0 you are supposed to remove all your VFS folders.
My suggestion is to run a second instance of HFS, and to set up my solution so you can test it, and fine tune it.
By default HFS won't let you run a second instance. You can temporarily ignore this setting by holding the CTRL key.

I cannot be sure this is the best solution for you, since i may miss some details of your case, but from what i know,that's how I would solve it.

Quote
while still maintaining the user account (name and p/w) for when i originally set it up for "c:\john"? so basically, HFS will be going to "c:\hfs" instead of just "c:\" to find "john's" folder?

you won't have a "john" folder in your VFS, but just the folder "john" on disk and the account "john" in hfs.

Quote
and it will also ONLY allow the user account that i just created to ONLY access their own folder (ex. john can access ONLY "c:\hfs\john" but not "c:\hfs\frank" or anyone else...likewise for frank to ONLY access "c:\hfs\frank" but not john or anyone else, etc.?

yes


Offline CJ

  • Occasional poster
  • *
    • Posts: 37
    • View Profile
absolutely cool!  8) thank you rejetto! i very much appreciate all of your help! i will try it and let you know how it's going.  just wanted to make sure that everything was going to work before i got too far into it.  one last thing...i know next to jack about scripting save some VERY basic html.  where do i copy the script to and how do i execute it?  thanks again! :D