Updated to SEP, very meager beginnings of full ACL support

This commit is contained in:
zone 2001-06-27 07:20:12 +00:00
parent bde7203314
commit 6627870e4d

View File

@ -2,9 +2,8 @@
/**************************************************************************\ /**************************************************************************\
* phpGroupWare API - VFS * * phpGroupWare API - VFS *
* This file written by Jason Wies (Zone) <zone@users.sourceforge.net> * * This file written by Jason Wies (Zone) <zone@users.sourceforge.net> *
* and Dan Kuykendall <seek3r@phpgroupware.org>, *
* This class handles file/dir access for phpGroupWare * * This class handles file/dir access for phpGroupWare *
* Copyright (C) 2000, 2001 Dan Kuykendall, Jason Wies * * Copyright (C) 2001 Jason Wies *
* -------------------------------------------------------------------------* * -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API * * This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api * * http://www.phpgroupware.org/api *
@ -26,7 +25,7 @@
/*! /*!
@class vfs @class vfs
@abstract virtual file system @abstract virtual file system
@description Authors: Zone, Seek3r @description Authors: Zone
*/ */
/* Relative defines. Used mainly by getabsolutepath () */ /* Relative defines. Used mainly by getabsolutepath () */
@ -40,6 +39,15 @@
define (VFS_REAL, 1024); define (VFS_REAL, 1024);
define (RELATIVE_ALL, RELATIVE_PATH); define (RELATIVE_ALL, RELATIVE_PATH);
/* ACL access defines. Used by acl_check () */
define (VFS_ACL_READ, 1);
define (VFS_ACL_ADD, 2);
define (VFS_ACL_EDIT, 4);
define (VFS_ACL_DELETE, 8);
define (VFS_ACL_PRIVATE, 16);
define (VFS_ACL_USER, VFS_ACL_READ|VFS_ACL_ADD|VFS_ACL_EDIT|VFS_ACL_DELETE);
define (VFS_ACL_ALL, VFS_ACL_READ|VFS_ACL_ADD|VFS_ACL_EDIT|VFS_ACL_DELETE|VFS_ACL_PRIVATE);
/*! /*!
@class path_class @class path_class
@abstract helper class for path_parts @abstract helper class for path_parts
@ -217,7 +225,7 @@ class vfs
function path_parts ($string, $relatives = array (RELATIVE_CURRENT), $object = True) function path_parts ($string, $relatives = array (RELATIVE_CURRENT), $object = True)
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$sep = $phpgw_info["server"]["dir_separator"]; $sep = SEP;
$rarray["mask"] = RELATIVE_NONE; $rarray["mask"] = RELATIVE_NONE;
@ -384,7 +392,7 @@ class vfs
} }
else else
{ {
$sep = $phpgw_info["server"]["dir_separator"]; $sep = SEP;
} }
/* if RELATIVE_CURRENT, retrieve the current mask */ /* if RELATIVE_CURRENT, retrieve the current mask */
@ -446,6 +454,20 @@ class vfs
return $basedir; return $basedir;
} }
/*!
@function acl_check
@abstract Check ACL access to $file for $this->account_id
@param $file File to check access of
@param $relatives Standard relativity array
@param $operation Operation to check access to. In the form of a VFS_ACL defines bitmask. Default is read
@result True if access is ok, function does not return if access is bad
*/
function acl_check ($file, $relatives = array (RELATIVE_CURRENT), $operation = VFS_ACL_READ)
{
global $phpgw, $phpgw_info;
}
/*! /*!
@function cd @function cd
@abstract Change directory @abstract Change directory
@ -460,7 +482,7 @@ class vfs
if ($relatives[0] & VFS_REAL) if ($relatives[0] & VFS_REAL)
{ {
$sep = $phpgw_info["server"]["dir_separator"]; $sep = SEP;
} }
else else
{ {
@ -655,6 +677,8 @@ class vfs
$f = $this->path_parts ($from, array ($relatives[0])); $f = $this->path_parts ($from, array ($relatives[0]));
$t = $this->path_parts ($to, array ($relatives[1])); $t = $this->path_parts ($to, array ($relatives[1]));
// $this->acl_check ($t, array ($t->mask));
umask(000); umask(000);
if ($this->file_type ($from, array ($relatives[0])) != "Directory") if ($this->file_type ($from, array ($relatives[0])) != "Directory")
@ -1245,3 +1269,5 @@ class vfs
return $this->ls ($dir, $relatives, $checksubdirs, $mime_type, $nofiles); return $this->ls ($dir, $relatives, $checksubdirs, $mime_type, $nofiles);
} }
} }
?>