~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/studpath.py

  • Committer: mattgiuca
  • Date: 2008-02-29 01:18:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:621
Added 2 new apps: home and subjects. Both fairly incomplete, just a basic
    skeleton.
    "home" is the new default app, replacing "files".
    (It has a link to files).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
# they dont own.
26
26
 
27
27
import os
28
 
import stat
 
28
 
29
29
import pysvn
30
30
 
31
31
import conf
101
101
 
102
102
    return (user, jail, path)
103
103
 
104
 
def svnpublished(path):
 
104
def published(path):
105
105
    """Given a path on the LOCAL file system, determines whether the path has
106
106
    its "ivle:published" property active (in subversion). Returns True
107
107
    or False."""
113
113
        return False
114
114
    return len(props) > 0
115
115
 
116
 
def published(path):
117
 
    """Given a path on the LOCAL file system, determines whether the path has a 
118
 
    '.published' file.  Returns True or False."""
119
 
    publish_file_path = os.path.join(path,'.published')
120
 
    return os.access(publish_file_path,os.F_OK)
121
 
 
122
 
def worldreadable(path):
123
 
    """Given a path on the LOCAL file system, determines whether the path is 
124
 
    world readble. Returns True or False."""
125
 
    try:
126
 
        mode = os.stat(path).st_mode
127
 
        if mode & stat.S_IROTH:
128
 
            return True
129
 
        else:
130
 
            return False
131
 
    except OSError, e:
132
 
        return False
133
 
 
134
 
 
135
116
def authorize(req):
136
117
    """Given a request, checks whether req.user is allowed to
137
118
    access req.path. Returns None on authorization success. Raises
163
144
    """
164
145
    _, path = url_to_local(req.path)
165
146
    dirpath, _ = os.path.split(path)
166
 
    if not (worldreadable(dirpath) and published(dirpath)):
 
147
    if not published(dirpath):
167
148
        req.throw_error(req.HTTP_FORBIDDEN)