Skip to main content

A tiny wrapper to get information about file permissions

Project description

Permissions

Permissions provides a tiny wrapper on top of built-in Python's libraries to get information about file permissions in Unix systems.

Motivation

Currently everything related to permission management is spreaded across few packages. It is nice and handy to have everything gathered together. Permissions is quite incomplete at the moment and any kind of missed functionality is welcome as pull requests or GitHub issues.

Installation

pip install file-permissions

Example

from permissions import get_permissions_from

p = get_permissions_from('test.txt')  # returns PermissionsContainer object
p.executable()
# False
p.readable()
# True

Reference

Available fields in PermissionsContainer:

  1. executable - boolean, indicates whether file could be executed by current user or not;
  2. group - object(pwd.struct_group), contains information about group the file belongs to. Available fields there are:
    • gr_name
    • gr_passwd
    • gr_gid
    • gr_mem
  3. is_sticky - boolean, inficates whether file has sticky bit or not.
  4. owner - object(pwd.struct_passwd), contains information about user the file belongs to. Available fields there are:
    • pw_name
    • pw_passwd
    • pw_uid
    • pw_gid
    • pw_gecos
    • pw_dir
    • pw_shell
  5. readable - boolean, indicates whether file could be read by current user or not;
  6. sgid - returns SGID if set or 0;
  7. suid - returns SUID if set or 0;
  8. umask - str, file permissions as umask, e. g. 0755, 0400;
  9. writable - boolean, indicates whether file could be written by current user or not;

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

file_permissions-0.2-py2-none-any.whl (2.6 kB view details)

Uploaded Python 2

File details

Details for the file file_permissions-0.2-py2-none-any.whl.

File metadata

  • Download URL: file_permissions-0.2-py2-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.11.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.12

File hashes

Hashes for file_permissions-0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 95236d8a12a40b4dc8739f24efaee8cd1491c43b1fcacdd214f5b29fa986db55
MD5 e325f22c6ae936830b09781ed6aa19e7
BLAKE2b-256 4caaa86de98bcca1e1336de41e6f96cf0de04547df806a7edbf44dd3785253cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page