Metadata-Version: 2.1
Name: pyusermanager
Version: 2.0.1
Summary: Some Functions to manage a User Database and do stuff with it!
Home-page: https://github.com/Aurvandill137/pyusermanager
Author: Ole Hannemann
Author-email: cerberus885@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.9
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
Requires-Dist: bcrypt
Requires-Dist: pony
Requires-Dist: python-ldap
Requires-Dist: setuptools (>=45.0)

<h1 align="center">pyusermanager</h1>
<h3 align="center">a user management libary for web services or other stuff</h3>
<br>
<p align="center">
<a href="https://pypi.org/project/pyusermanager/"><img height="20" alt="PyPI version" src="https://img.shields.io/pypi/v/pyusermanager"></a>
<a href="https://pypi.org/project/pyusermanager/"><img height="20" alt="Supported python versions" src="https://img.shields.io/pypi/pyversions/pyusermanager"></a>
<br>
<a href="https://pypi.org/project/black"><img height="20" alt="Black badge" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<a href="https://codeclimate.com/github/Aurvandill137/pyusermanager/maintainability"><img src="https://api.codeclimate.com/v1/badges/97cf369553f228ce3a3c/maintainability" /></a>
<br>
<a href="https://codeclimate.com/github/Aurvandill137/pyusermanager/test_coverage"><img src="https://api.codeclimate.com/v1/badges/97cf369553f228ce3a3c/test_coverage" /></a>
<a href="https://pyusermanager.readthedocs.io/en/latest/"><img height="20" alt="Documentation status" src="https://img.shields.io/badge/documentation-up-00FF00.svg"></a>
</p>

# Dev Branch

# 1. Info

This Project is aimed to simplify building apis which require User authentification

## 1.2 Table of Contents

- [1. Info](#1-info)
  - [1.2 Table of Contents](#12-table-of-contents)
- [2. Features](#2-features)
- [3. Plans for the Future](#3-plans-for-the-future)
- [4. Documentation Status](#4-documentation-status)
  - [4.1 General](#41-general)
  - [4.2 Modules](#42-modules)
- [5. Quickstart](#5-quickstart)
- [6. Changelog](#6-changelog)

# 2. Features

* login
* registration
* Token generation
* Token Verification
* Different Token Types
  * Auth_Token      -> Used for user verification
  * ResetCode       -> Used to auth password Resets
  * ActivationCode  -> Used to activate user Accounts
* Custom Exceptions
  * MissingUserExceptions
  * NotInitedException
  * AlreadyExistsException
  * TokenMissingException

# 3. Plans for the Future

- [x] ~~Refactor db_functions.py (v.2.0.0)~~
- [ ] Custom Return Object instead of dicts
- [x] ~~fix Code Smells~~
- [x] ~~implement token verification for other tokens than auth_token~~
- [ ] implement propper logging (v.2.1.0)
- [ ] writing Tests
    - [ ] Token Module
    - [ ] Config Module
    - [ ] Perm Module
    - [ ] UserFunctions
    - [ ] Login Functions

# 4. Documentation Status

## 4.1 General

- [x] ~~Created readthedocs page~~
- [ ] How to Install
- [ ] How to Use


## 4.2 Modules

- [ ] uth_type_enum
- [ ] custom_exceptions
- [ ] data_classes
- [ ] ldap_stuff
- [ ] login_class
- [ ] perms_class
- [ ] user_funcs
- [ ] Token
     - [ ] token_base_class
     - [ ] token_auth_class
     - [ ] token_reset_class
     - [ ] token_activation_class
- [ ] Config</li>
     - [ ] config_base_class
     - [ ] config_ad_class
     - [ ] config_db_class
     - [ ] config_general_class

# 5. Quickstart

```python

from pyusermanager import *
from pyusermanager.Config import *
from pyusermanager.Config.db_providers import *
import pyusermanager.Token as Token

# Create DB-Config
db_cfg = MYSQL_Provider(
    host="127.0.0.1", port=3306, user="test", passwd="test1234", db="users"
)
# setup general config
cfg = General_Config(auto_activate_accounts=False)
# connect to db
cfg.bind(db_cfg)

#creating user
try:
    user(cfg, "testuser").create("password")
except PyUserExceptions.AlreadyExistsException:
    print("user already exists")

#if login was successfull we want to create an auth token and print it
if login(cfg,'testuser','password'):
    token = Token.Auth(cfg,username="testuser")
    token.create("127.0.0.1",valid_days=1)
    print(f"Token: {token.token}")

testtoken = Token.Auth(cfg,token=token.token)
print(f"trying to verify Token: {testtoken.token}\nreturnes: {testtoken.verify('127.0.0.1')}")

#creating a perm and assigning it to a user
testperm = Perm(cfg,"testperm")
testperm.create()
print(f"tyring to assign it to testuser: {testperm.assign_to_user('testuser')}")


```

more example can be found in howtouse.py


# 6. Changelog

## v2.0.0 ([git](https://github.com/Aurvandill137/pyusermanager/releases/tag/v2.0.0)) ([pypi](https://pypi.org/project/pyusermanager/2.0.0/))

### Changed

* alot of rewrites
* please look at the howtouse.py and documentation!

## v1.0.5 ([git](https://github.com/Aurvandill137/pyusermanager/releases/tag/v1.0.5)) ([pypi](https://pypi.org/project/pyusermanager/1.0.5/))

### Changed

* get_extended_info not takes an extra optional arg (include_email) if its not None it will return the user email in the user_dict


