188 def access(filename,mode):
189 if mode == os.F_OK:
return exists(filename)
192 filemode = st.st_mode
196 rOK = ( filemode & statconsts.S_IROTH )
or \
197 ( filemode & statconsts.S_IRGRP
and os.getgid() == gid )
or \
198 ( filemode & statconsts.S_IRUSR
and os.getuid() == uid )
or \
199 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
200 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
205 wOK = ( filemode & statconsts.S_IWOTH )
or \
206 ( filemode & statconsts.S_IWGRP
and os.getgid() == gid )
or \
207 ( filemode & statconsts.S_IWUSR
and os.getuid() == uid )
or \
208 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
209 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
214 xOK = ( filemode & statconsts.S_IXOTH )
or \
215 ( filemode & statconsts.S_IXGRP
and os.getgid() == gid )
or \
216 ( filemode & statconsts.S_IXUSR
and os.getuid() == uid )
or \
217 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
218 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
222 return rOK
and wOK
and xOK