rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: Mars on January 20, 2008, 06:49:10 PM
-
a virtual problem with {{add folder|pathnamefolder|foldername}} i think missing one parameter we can define as this
{{add folder|pathnamefolder|foldername|[private|public|hidetree|hide|no log]}}
if one user is logged and when he use private then the folder has an access only to this account; with a virtual folder it is easy, with a real folder we can include in this folder an hfs.access.txt with right access as in hfs.vfs
-
PS: I forget, upload to foldername must be activated for this account.
something as
procedure addFolder();
var
cmd: string;
i: integer;
f: Tfile;
s: string;
begin
if not stringExists(p, ['real','virtual']) then exit;
if (p = 'real') and not directoryExists(par(1)) then exit;
s:=par(1);
if (p = 'virtual') and not validFilename(s) then exit;
if (p = 'real') and not isAbsolutePath(s) and assigned(md.folder) then
s:=md.folder.resource+'\'+s;
if p = 'virtual' then
f:=Tfile.createVirtualFolder(s)
else
begin
f:=Tfile.create(s);
if validFilename(par(2)) then
f.name:=par(2);
end;
if mainfrm.addFile(f, NIL, TRUE) = NIL then
f.Free;
result:='';
// from here by security if a user not logged then options can be prohibited
if (pars.count > 3) and (par(3) = 'private') then
for i := 3 to pars.count - 1 do
begin
cmd:=par(i);
if cmd = 'private' then
begin
// create restrict access to %user%
// allow upload access to %user%
end;
if cmd = 'hide' then
include(f.flags, FA_HIDDEN);
if cmd = 'no log' then
include(f.flags, FA_DONT_LOG);
if cmd = 'hide tree' then
include(f.flags, FA_HIDDENTREE);
end;
end; // addFolder
-
That macro (and {{set item}} as well) was not created to be used by users, but by templates, inside the [special:import] section.
If you mean to make it usable by users, it should be discussed HOW before.
Anyhow, I would not duplicate features of {{set item}} in {{add folder}}.
-
It is possible to offer in an authorized user (logged) to create one or several directories in its personal space (That I have create to him) on my server, this is possible only if the template is made well and with my authorization, but the directory has to can be protected in its creation, and by using a specific form of management of files using the macro adequate