186 def access(filename,mode):
187 if mode == os.F_OK:
return exists(filename)
190 filemode = st.st_mode
194 rOK = ( filemode & statconsts.S_IROTH )
or \
195 ( filemode & statconsts.S_IRGRP
and os.getgid() == gid )
or \
196 ( filemode & statconsts.S_IRUSR
and os.getuid() == uid )
or \
197 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
198 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
203 wOK = ( filemode & statconsts.S_IWOTH )
or \
204 ( filemode & statconsts.S_IWGRP
and os.getgid() == gid )
or \
205 ( filemode & statconsts.S_IWUSR
and os.getuid() == uid )
or \
206 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
207 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
212 xOK = ( filemode & statconsts.S_IXOTH )
or \
213 ( filemode & statconsts.S_IXGRP
and os.getgid() == gid )
or \
214 ( filemode & statconsts.S_IXUSR
and os.getuid() == uid )
or \
215 ( filemode & statconsts.S_ISGID
and os.getegid() == gid )
or \
216 ( filemode & statconsts.S_ISUID
and os.geteuid() == uid )
220 return rOK
and wOK
and xOK