ppss-auth 0.7__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/__pycache__/__init__.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/__pycache__/constants.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/__pycache__/models.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/__pycache__/routes.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/ppss_auth_utils/__pycache__/__init__.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/ppss_auth_utils/__pycache__/password.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/layouts/masterlayout.mako +7 -1
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/views/__pycache__/__init__.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv3/lib/python3.6/site-packages/ppss_auth/views/__pycache__/auth.cpython-36.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/views/auth.py +4 -4
- var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info → venv3/lib/python3.6/site-packages/ppss_auth-0.7.2.egg-info}/PKG-INFO +117 -2
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/__init__.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/constants.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/models.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/ppss_auth_utils/__init__.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/ppss_auth_utils/password.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/routes.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/templates/layout.mako +0 -9
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/views/__init__.pyc +0 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/views/auth.pyc +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/__init__.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/constants.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/models.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_static/loader.js +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_static/ppssauth.css +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_static/ppssauth.js +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_static/template.html +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_utils/__init__.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/ppss_auth_utils/password.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/routes.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/change.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/editgroup.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/editperm.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/edituser.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/layouts/midlayout.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/layouts/public.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/listgroup.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/listperm.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/listuser.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/templates/login.mako +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7 → venv3/lib/python3.6}/site-packages/ppss_auth/views/__init__.py +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info → venv3/lib/python3.6/site-packages/ppss_auth-0.7.2.egg-info}/SOURCES.txt +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info → venv3/lib/python3.6/site-packages/ppss_auth-0.7.2.egg-info}/dependency_links.txt +0 -0
- /var/www/vhosts/pyramid.localhost.me/app/{venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info → venv3/lib/python3.6/site-packages/ppss_auth-0.7.2.egg-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
</head>
|
|
26
26
|
<body class="ppss_auth">
|
|
27
27
|
${next.body()}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<%block name="ppssauthfooterjs">
|
|
31
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
|
32
|
+
</%block>
|
|
33
|
+
|
|
28
34
|
</body>
|
|
29
35
|
|
|
30
|
-
</html>
|
|
36
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
@@ -128,8 +128,8 @@ class AuthController():
|
|
|
128
128
|
|
|
129
129
|
def login(self):
|
|
130
130
|
r = self.request
|
|
131
|
-
postloginpage = self.request.referer if self.request.referer!=self.request.route_url("ppsslogin") else Conf.postloginroute
|
|
132
|
-
postloginpage = Conf.postloginroute
|
|
131
|
+
postloginpage = self.request.referer if self.request.referer!=self.request.route_url("ppsslogin") else r.route_url(Conf.postloginroute)
|
|
132
|
+
#postloginpage = Conf.postloginroute
|
|
133
133
|
if r.POST:
|
|
134
134
|
username = r.params.get("username",u"")
|
|
135
135
|
password = r.params.get("password",u"")
|
|
@@ -141,7 +141,7 @@ class AuthController():
|
|
|
141
141
|
r.session['user'] = {'id':'1','name':'admin'}
|
|
142
142
|
headers = remember(r, u"1")
|
|
143
143
|
r.userid=u"1"
|
|
144
|
-
return HTTPFound(
|
|
144
|
+
return HTTPFound(postloginpage,headers=headers)
|
|
145
145
|
res = PPSsuser.checkLogin(username,password,r.dbsession)
|
|
146
146
|
if res:
|
|
147
147
|
l.debug("{username} logged in as normal user".format(username=username) )
|
|
@@ -149,7 +149,7 @@ class AuthController():
|
|
|
149
149
|
r.session['user'] = {'id':res.id,'name':username}
|
|
150
150
|
headers = remember(r, res.id)
|
|
151
151
|
r.session['principals'] = [str("g:"+group.name ) for group in res.groups ] #["g:user"]
|
|
152
|
-
return HTTPFound(
|
|
152
|
+
return HTTPFound(postloginpage,headers=headers)
|
|
153
153
|
self.request.dbsession.query(PPSsuser).filter()
|
|
154
154
|
l.warn("Login attempt failed for user {user}".format(user=username))
|
|
155
155
|
return {'logintpl': Conf.publictemplateinherit ,'msg':'something went wrong with your login. Please check your informations'}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ppss-auth
|
|
3
|
-
Version: 0.7
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: simple auth scheme for pyramid, based on Mako template and sqlalchemy backend
|
|
5
5
|
Home-page: http://www.pingpongstars.it
|
|
6
6
|
Author: pdepmcp
|
|
@@ -91,6 +91,121 @@ Description: This package aims to give and easy pluggable module to provide auth
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
|
|
94
|
+
# Things to know (devs only)
|
|
95
|
+
|
|
96
|
+
## database
|
|
97
|
+
Thi package provide the creation and usage of 3 main tables (and the other tables required for ER consistency):
|
|
98
|
+
- ppss_user - containing basic information about the users (username, hashed password and related data )
|
|
99
|
+
- ppss_group - user groups to allow for easier handling of user groups and permissions
|
|
100
|
+
- ppss_permission - a list of permissions (just an id and a name)
|
|
101
|
+
|
|
102
|
+
## models
|
|
103
|
+
|
|
104
|
+
### PPSsuser
|
|
105
|
+
|
|
106
|
+
This represents the user of your application.
|
|
107
|
+
She has a _username_, a _password_ and relation to her _groups_. She also has a _enabled_ property and some timestamps (creation times, and similar times).
|
|
108
|
+
|
|
109
|
+
Use the _setPassword(password)_ method on PPSsuser instances to change the password, providing the new password.
|
|
110
|
+
|
|
111
|
+
_todict(self)_ is a commodity method to get a dict of the main properties.
|
|
112
|
+
|
|
113
|
+
### PPSsgroup
|
|
114
|
+
|
|
115
|
+
This class represnts the groups of your users. It's a many-to-many relation: each user can belong to many groups, and each group can gather many users.
|
|
116
|
+
Other than a _name_ and the _enabled_ flag (integer with 1 for enabled), its main user is the many-to-many relation to permissions. This means that all users in the same group share (at least) all the permissions given to the group.
|
|
117
|
+
|
|
118
|
+
### PPSspermission
|
|
119
|
+
|
|
120
|
+
This class represents the permissions of the application. You can create new permissions and link them to group. You can use those permissions in the _permission_ attribute of the _view\_config_ decorator to restrict usage of some methods using ACL, or you can check it whenever needed.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
This package aims to give and easy pluggable module to provide authentication and user maintennance in a Pyramid web application.
|
|
125
|
+
It relies the Pyramid+SQLAlchemy+Mako stack. Implementation for other template languages is on the roadmap.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# Installation and setup
|
|
129
|
+
|
|
130
|
+
## Install the package
|
|
131
|
+
Install the package with:
|
|
132
|
+
```sh
|
|
133
|
+
pip install ppss_auth
|
|
134
|
+
```
|
|
135
|
+
or put ppss_auth in your app dependencies (setup.py, in the install_requires list of packages)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
To activate the package, in your main *\_\_init\_\_.py* file, inside the main function, add this line:
|
|
140
|
+
```python
|
|
141
|
+
config.include('ppss_auth')
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
in your models include the ppss_auth's models with this line:
|
|
145
|
+
```python
|
|
146
|
+
from ppss_auth.models import *
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## Configure the database
|
|
152
|
+
This can be a zero-db-conf module:
|
|
153
|
+
run the app with _ppss_auth.initdb_ set to True (that is the default for the params, so you can even leave it blank: see configuration, below). You are done with this, unless you need more in-depth initialization (follow reading)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### You want to do it yourself
|
|
157
|
+
|
|
158
|
+
To init the Tables manually, in the initialization script (usually in *scripts/intializedb.py*), add this row:
|
|
159
|
+
```python
|
|
160
|
+
from ppss_auth import (models as ppssmodels)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
and while creating the default data (in the "with transaction.manager" block of code), use something like:
|
|
164
|
+
```python
|
|
165
|
+
ppssmodels.initdb(dbsession,createdefault=False)
|
|
166
|
+
```
|
|
167
|
+
This creates the tables and, if *createdefault* evaulates to True, it create a default admin/admin user with the admin permission.
|
|
168
|
+
Please change the password to avoid secuirity issues.
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
You can create some data as well. Refer to [models] section, below, for more info.
|
|
172
|
+
|
|
173
|
+
## Requirements
|
|
174
|
+
When a user login, *essionauthpolicy* is used to store her informations (userid and user groups).
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
## ini file configuration
|
|
178
|
+
ppss_auth use these info from the ini file:
|
|
179
|
+
|
|
180
|
+
*default user*
|
|
181
|
+
- ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
182
|
+
- ppss_auth.adminpass - the corresponding password. If not provided the admin is not allowed to log in (with the ini credentials. It may exist in database)
|
|
183
|
+
|
|
184
|
+
*db stuff*
|
|
185
|
+
- ppss_auth.initdb [True] - true/false value, tells the lib to init db automatically on first run.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
*routes*
|
|
189
|
+
- ppss_auth.login_url [/login] - url for login.
|
|
190
|
+
- ppss_auth.logout_url [/logout]- url for logout.
|
|
191
|
+
|
|
192
|
+
*where to land after succesfull login/logout*
|
|
193
|
+
- ppss_auth.post_login_follow - try to redirect the browser back to where it came from after successful login (use true case insensitive to activate it). It's useful if combined with the forbidden pattern
|
|
194
|
+
- ppss_auth.post_login_route [home] - name of the route where to send the browser after user logged in. Ignored if ppss_auth.post_login_follow is set to true AND there is a referer to go to.
|
|
195
|
+
- ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
196
|
+
|
|
197
|
+
*templates stuff*
|
|
198
|
+
You can override all this values and even provide a mako-free environment. This can be a litlle tricky, but there is no hard-coded dependency to mako, just the defaults.
|
|
199
|
+
|
|
200
|
+
- ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
201
|
+
- ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
202
|
+
- ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
203
|
+
- ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
204
|
+
- ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
94
209
|
# Things to know (devs only)
|
|
95
210
|
|
|
96
211
|
## database
|
|
@@ -127,5 +242,5 @@ Classifier: Programming Language :: Python :: 2
|
|
|
127
242
|
Classifier: Programming Language :: Python :: 2.7
|
|
128
243
|
Classifier: Programming Language :: Python :: 3.6
|
|
129
244
|
Classifier: Programming Language :: Python :: 2.7
|
|
130
|
-
Requires-Python: >=2.7
|
|
245
|
+
Requires-Python: >=2.7
|
|
131
246
|
Description-Content-Type: text/markdown
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/__init__.pyc
DELETED
|
Binary file
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/constants.pyc
DELETED
|
Binary file
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/models.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/routes.pyc
DELETED
|
Binary file
|
|
Binary file
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/views/auth.pyc
DELETED
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|