ppss-auth 0.6.3__tar.gz → 0.7__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.
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/__init__.py +4 -4
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/__init__.pyc +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/constants.py +2 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/constants.pyc +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/models.py +19 -4
- 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__.py +1 -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
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/routes.py +2 -2
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/routes.pyc +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/editgroup.mako +35 -26
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/templates/layout.mako +9 -0
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/templates/layouts/masterlayout.mako +30 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/listgroup.mako +1 -1
- var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/views/__init__.pyc +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/views/auth.py +6 -5
- 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/site-packages/ppss_auth-0.7-py2.7.egg-info/PKG-INFO +131 -0
- ppss_auth-0.6.3/MANIFEST.in +0 -2
- ppss_auth-0.6.3/PKG-INFO +0 -61
- ppss_auth-0.6.3/README.md +0 -45
- ppss_auth-0.6.3/changelog.txt +0 -2
- ppss_auth-0.6.3/ppss_auth/ppss_auth_utils/__init__.py +0 -1
- ppss_auth-0.6.3/ppss_auth/templates/layouts/masterlayout.mako +0 -13
- ppss_auth-0.6.3/ppss_auth.egg-info/PKG-INFO +0 -61
- ppss_auth-0.6.3/setup.cfg +0 -4
- ppss_auth-0.6.3/setup.py +0 -74
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/ppss_auth_static/loader.js +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/ppss_auth_static/ppssauth.css +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/ppss_auth_static/ppssauth.js +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/ppss_auth_static/template.html +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/ppss_auth_utils/password.py +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/change.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/editperm.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/edituser.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/layouts/midlayout.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/layouts/public.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/listperm.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/listuser.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/templates/login.mako +0 -0
- {ppss_auth-0.6.3 → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages}/ppss_auth/views/__init__.py +0 -0
- {ppss_auth-0.6.3/ppss_auth.egg-info → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info}/SOURCES.txt +0 -0
- {ppss_auth-0.6.3/ppss_auth.egg-info → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info}/dependency_links.txt +0 -0
- {ppss_auth-0.6.3/ppss_auth.egg-info → var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth-0.7-py2.7.egg-info}/top_level.txt +0 -0
|
@@ -8,8 +8,8 @@ import zope.sqlalchemy
|
|
|
8
8
|
|
|
9
9
|
from pyramid.authorization import ACLAuthorizationPolicy
|
|
10
10
|
from pyramid.authentication import SessionAuthenticationPolicy
|
|
11
|
-
from constants import Conf
|
|
12
|
-
from models import initdb,PPSsuser
|
|
11
|
+
from .constants import Conf
|
|
12
|
+
from .models import initdb,PPSsuser
|
|
13
13
|
from .routes import configRoutes
|
|
14
14
|
|
|
15
15
|
|
|
@@ -50,12 +50,12 @@ def includeme(config):
|
|
|
50
50
|
#ppssauthpolicy = PPSSAuthenticationPolicy(config.get_settings())
|
|
51
51
|
settings = config.get_settings()
|
|
52
52
|
Conf.setup(settings)
|
|
53
|
-
config.add_request_method(getLoggedUser,'loggeduser',
|
|
53
|
+
config.add_request_method(getLoggedUser,'loggeduser',reify=True)
|
|
54
54
|
initAuthDb(settings)
|
|
55
55
|
|
|
56
56
|
configRoutes(config,Conf)
|
|
57
57
|
|
|
58
|
-
from views.auth import getPrincipals,ACLRoot
|
|
58
|
+
from .views.auth import getPrincipals,ACLRoot
|
|
59
59
|
authz_policy = ACLAuthorizationPolicy()
|
|
60
60
|
config.set_authentication_policy(SessionAuthenticationPolicy(callback=getPrincipals) )
|
|
61
61
|
config.set_authorization_policy(ACLAuthorizationPolicy())
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/__init__.pyc
ADDED
|
Binary file
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/constants.pyc
ADDED
|
Binary file
|
|
@@ -28,7 +28,7 @@ import logging,uuid,hashlib
|
|
|
28
28
|
metadata = MetaData(naming_convention=NAMING_CONVENTION)
|
|
29
29
|
Base = declarative_base(metadata=metadata)
|
|
30
30
|
|
|
31
|
-
from constants import Conf
|
|
31
|
+
from .constants import Conf
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
l = logging.getLogger('ppssauth.models')
|
|
@@ -117,7 +117,7 @@ class PPSsuser(Base,commonTable):
|
|
|
117
117
|
|
|
118
118
|
@classmethod
|
|
119
119
|
def checkLogin(cls,user,password,dbsession):
|
|
120
|
-
s = hashlib.sha512(password)
|
|
120
|
+
s = hashlib.sha512(password.encode('utf-8'))
|
|
121
121
|
res = dbsession.query(cls).filter(cls.username==user).filter(cls.password==s.hexdigest()).all()
|
|
122
122
|
return res[0] if len(res)==1 else None
|
|
123
123
|
|
|
@@ -130,10 +130,25 @@ class PPSsuser(Base,commonTable):
|
|
|
130
130
|
return { "id": self.id, "username":self.username,"enabled":self.enabled}
|
|
131
131
|
|
|
132
132
|
def setPassword(self,password):
|
|
133
|
-
s = hashlib.sha512(password)
|
|
133
|
+
s = hashlib.sha512(password.encode('utf-8'))
|
|
134
134
|
self.password=s.hexdigest()
|
|
135
135
|
return self
|
|
136
136
|
|
|
137
|
+
def getPermissions(self):
|
|
138
|
+
result = set()
|
|
139
|
+
for g in self.groups:
|
|
140
|
+
if g.enabled:
|
|
141
|
+
for p in g.permissions:
|
|
142
|
+
result.add( (p.id, p.name) )
|
|
143
|
+
return result
|
|
144
|
+
# return set([p.name for p in [g.permissions for g in self.groups if g.enabled]] )
|
|
145
|
+
|
|
146
|
+
def isSuperUser(self):
|
|
147
|
+
for p in self.getPermissions():
|
|
148
|
+
if p[0]==1:
|
|
149
|
+
return True
|
|
150
|
+
return False
|
|
151
|
+
|
|
137
152
|
def __unicode__(self):
|
|
138
153
|
return u"<PPSsuser ({id}-{name},{enabled})>".format(id=self.id,name=self.username, enabled=self.enabled)
|
|
139
154
|
|
|
@@ -144,7 +159,7 @@ class PPSspasswordhistory(Base):
|
|
|
144
159
|
__tablename__ = 'ppss_passwordhistory'
|
|
145
160
|
id = Column(Integer, primary_key=True)
|
|
146
161
|
user_id = Column(Integer, ForeignKey('ppss_user.id'))
|
|
147
|
-
insertdt
|
|
162
|
+
insertdt = Column(DateTime,default=datetime.now)
|
|
148
163
|
password = Column(Unicode(1024))
|
|
149
164
|
|
|
150
165
|
user = relationship("PPSsuser", backref=backref('passowrdhistory',order_by="PPSspasswordhistory.id"))
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .password import *
|
|
Binary file
|
|
Binary file
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
l = logging.getLogger('ppssauth')
|
|
3
3
|
|
|
4
4
|
def configRoutes(config,Conf):
|
|
5
|
-
from views.auth import AuthController
|
|
5
|
+
from .views.auth import AuthController
|
|
6
6
|
|
|
7
7
|
config.include("pyramid_beaker")
|
|
8
8
|
config.add_static_view( name='ppss_auth_static', path='ppss_auth_static', cache_max_age=3600)
|
|
@@ -33,7 +33,7 @@ def configRoutes(config,Conf):
|
|
|
33
33
|
config.add_route('ppss:user:remove', '/user/remove/{userid}/{groupid}')
|
|
34
34
|
config.add_route('ppss:user:checkpassword', '/user/checkpassword/{userid}')
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
config.add_route('test:test',Conf.testurl)
|
|
37
37
|
|
|
38
38
|
########views
|
|
39
39
|
|
|
Binary file
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
<%inherit file="${context['midtpl']}" />
|
|
2
2
|
|
|
3
3
|
<div class="row">
|
|
4
|
-
<div class="col-
|
|
5
|
-
<form class="form
|
|
4
|
+
<div class="col-12">
|
|
5
|
+
<form class="form" action="${request.route_url('ppss:group:edit',elementid=groupid)}" method="POST">
|
|
6
6
|
<div class="form-group">
|
|
7
7
|
<input class="form-control" type="text" name="name" placeholder="group name" value="${group.name if group else ""}">
|
|
8
8
|
</div>
|
|
9
9
|
<div class="checkbox">
|
|
10
|
-
|
|
10
|
+
<label for="enablecheck">Enable group:</label>
|
|
11
11
|
<input id="enablecheck" name="enablecheck" type="checkbox" value="1" ${'checked="checked"' if group.enabled else ""}>
|
|
12
|
-
Enable group:</label>
|
|
13
12
|
</div>
|
|
14
|
-
<
|
|
15
|
-
|
|
13
|
+
<div>
|
|
14
|
+
<input class="btn btn-success" type="submit" name="submit" value="Apply"/>
|
|
15
|
+
<a class="btn btn-danger" href="${request.route_url('ppss:perm:delete',elementid=group.id)}">remove group</a>
|
|
16
|
+
</div>
|
|
16
17
|
<p>${msg}</p>
|
|
17
18
|
</form>
|
|
18
19
|
</div>
|
|
19
|
-
<div class="col-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</ul>
|
|
20
|
+
<div class="col-12">
|
|
21
|
+
<div class="row">
|
|
22
|
+
<div class="col-12 col-sm-6">
|
|
23
|
+
<h3>User to remove</h3>
|
|
24
|
+
<ul class="list-group" data-userdelete>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="col-12 col-sm-6">
|
|
28
|
+
<h3>User to add</h3>
|
|
29
|
+
<input type="text" data-user-autocomplete class="form-control" />
|
|
30
|
+
</br>
|
|
31
|
+
<ul class="list-group" data-useradd>
|
|
32
|
+
</ul>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
35
|
</div>
|
|
36
|
-
<div class="col-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
36
|
+
<div class="col-12">
|
|
37
|
+
<div class="row">
|
|
38
|
+
<div class="col-12 col-sm-6">
|
|
39
|
+
<h3>Perm to remove</h3>
|
|
40
|
+
<ul class="list-group" data-permdelete>
|
|
41
|
+
</ul>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="col-12 col-sm-6">
|
|
44
|
+
<h3>Perm to add</h3>
|
|
45
|
+
<ul class="list-group" data-permadd>
|
|
46
|
+
</ul>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
40
49
|
</div>
|
|
41
50
|
</div><!-- .row -->
|
|
42
51
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Login page</title>
|
|
4
|
+
<link rel="stylesheet" href="${request.static_url('ppss_auth:ppss_auth_static/ppssauth.css')}" type="text/css" />
|
|
5
|
+
<%block name="ppssautcss">
|
|
6
|
+
|
|
7
|
+
</%block>
|
|
8
|
+
|
|
9
|
+
<%block name="ppssauthheaderjs">
|
|
10
|
+
<link
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
|
|
13
|
+
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
|
|
14
|
+
crossorigin="anonymous"
|
|
15
|
+
/>
|
|
16
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
17
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.1.0/handlebars.min.js"></script>
|
|
18
|
+
<script
|
|
19
|
+
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
|
|
20
|
+
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
|
|
21
|
+
crossorigin="anonymous"
|
|
22
|
+
></script>
|
|
23
|
+
</%block>
|
|
24
|
+
|
|
25
|
+
</head>
|
|
26
|
+
<body class="ppss_auth">
|
|
27
|
+
${next.body()}
|
|
28
|
+
</body>
|
|
29
|
+
|
|
30
|
+
</html>
|
|
Binary file
|
|
@@ -164,7 +164,7 @@ class AuthController():
|
|
|
164
164
|
self.request.session.pop('user',None)
|
|
165
165
|
self.request.session.pop('principals',None)
|
|
166
166
|
|
|
167
|
-
return HTTPFound(self.request.route_url(Conf.
|
|
167
|
+
return HTTPFound(self.request.route_url(Conf.postlogoutroute),headers=headers)
|
|
168
168
|
|
|
169
169
|
def ppsschangepassword(self):
|
|
170
170
|
l.debug("change password")
|
|
@@ -213,7 +213,7 @@ class AuthController():
|
|
|
213
213
|
return retdict
|
|
214
214
|
newpassword = self.request.params.get("password","")
|
|
215
215
|
if newpassword:
|
|
216
|
-
l.info("*****changing password for {
|
|
216
|
+
l.info("*****changing password for {}".format(user.username) )
|
|
217
217
|
l.info("checkPassword result = {res}".format(res = checkPassword(user,newpassword) ))
|
|
218
218
|
user.setPassword(newpassword)
|
|
219
219
|
user.username = self.request.params.get("username",user.username)
|
|
@@ -307,7 +307,7 @@ class AuthController():
|
|
|
307
307
|
def deletePerm(self):
|
|
308
308
|
perm = PPSspermission.byId(int(self.request.matchdict.get('elementid',-1)))
|
|
309
309
|
|
|
310
|
-
if perm and perm.permtype !=
|
|
310
|
+
if perm and perm.permtype != 1:
|
|
311
311
|
self.request.dbsession.delete(perm)
|
|
312
312
|
res = {'res':True,'msg':"permesso cancellato"}
|
|
313
313
|
else:
|
|
@@ -391,5 +391,6 @@ class AuthController():
|
|
|
391
391
|
users = self.request.dbsession.query(PPSspermission).filter(PPSspermission.name.like(qparam)).all()
|
|
392
392
|
return {'res':True,'elements':[u.todict() for u in users]}
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
@view_config(route_name='test:test',permission='listuser',renderer=Conf.logintemplate)
|
|
395
|
+
def testroute(self):
|
|
396
|
+
return {}
|
var/www/vhosts/pyramid.localhost.me/app/venv/lib/python2.7/site-packages/ppss_auth/views/auth.pyc
ADDED
|
Binary file
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ppss-auth
|
|
3
|
+
Version: 0.7
|
|
4
|
+
Summary: simple auth scheme for pyramid, based on Mako template and sqlalchemy backend
|
|
5
|
+
Home-page: http://www.pingpongstars.it
|
|
6
|
+
Author: pdepmcp
|
|
7
|
+
Author-email: d.cariboni@pingpongstars.it
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: This package aims to give and easy pluggable module to provide authentication and user maintennance in a Pyramid web application.
|
|
10
|
+
It relies the Pyramid+SQLAlchemy+Mako stack. Implementation for other template languages is on the roadmap.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Installation and setup
|
|
14
|
+
|
|
15
|
+
## Install the package
|
|
16
|
+
Install the package with:
|
|
17
|
+
```sh
|
|
18
|
+
pip install ppss_auth
|
|
19
|
+
```
|
|
20
|
+
or put ppss_auth in your app dependencies (setup.py, in the install_requires list of packages)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
To activate the package, in your main *\_\_init\_\_.py* file, inside the main function, add this line:
|
|
25
|
+
```python
|
|
26
|
+
config.include('ppss_auth')
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
in your models include the ppss_auth's models with this line:
|
|
30
|
+
```python
|
|
31
|
+
from ppss_auth.models import *
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Configure the database
|
|
37
|
+
This can be a zero-db-conf module:
|
|
38
|
+
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)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### You want to do it yourself
|
|
42
|
+
|
|
43
|
+
To init the Tables manually, in the initialization script (usually in *scripts/intializedb.py*), add this row:
|
|
44
|
+
```python
|
|
45
|
+
from ppss_auth import (models as ppssmodels)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
and while creating the default data (in the "with transaction.manager" block of code), use something like:
|
|
49
|
+
```python
|
|
50
|
+
ppssmodels.initdb(dbsession,createdefault=False)
|
|
51
|
+
```
|
|
52
|
+
This creates the tables and, if *createdefault* evaulates to True, it create a default admin/admin user with the admin permission.
|
|
53
|
+
Please change the password to avoid secuirity issues.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
You can create some data as well. Refer to [models] section, below, for more info.
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
When a user login, *essionauthpolicy* is used to store her informations (userid and user groups).
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## ini file configuration
|
|
63
|
+
ppss_auth use these info from the ini file:
|
|
64
|
+
|
|
65
|
+
*default user*
|
|
66
|
+
- ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
67
|
+
- 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)
|
|
68
|
+
|
|
69
|
+
*db stuff*
|
|
70
|
+
- ppss_auth.initdb [True] - true/false value, tells the lib to init db automatically on first run.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
*routes*
|
|
74
|
+
- ppss_auth.login_url [/login] - url for login.
|
|
75
|
+
- ppss_auth.logout_url [/logout]- url for logout.
|
|
76
|
+
|
|
77
|
+
*where to land after succesfull login/logout*
|
|
78
|
+
- 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
|
|
79
|
+
- 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.
|
|
80
|
+
- ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
81
|
+
|
|
82
|
+
*templates stuff*
|
|
83
|
+
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.
|
|
84
|
+
|
|
85
|
+
- ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
86
|
+
- ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
87
|
+
- ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
88
|
+
- ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
89
|
+
- ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
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
|
+
Keywords: pyramid module authentication accelerator
|
|
123
|
+
Platform: UNKNOWN
|
|
124
|
+
Classifier: Development Status :: 4 - Beta
|
|
125
|
+
Classifier: Intended Audience :: Developers
|
|
126
|
+
Classifier: Programming Language :: Python :: 2
|
|
127
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
128
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
129
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
130
|
+
Requires-Python: >=2.7, >=3.6
|
|
131
|
+
Description-Content-Type: text/markdown
|
ppss_auth-0.6.3/MANIFEST.in
DELETED
ppss_auth-0.6.3/PKG-INFO
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ppss_auth
|
|
3
|
-
Version: 0.6.3
|
|
4
|
-
Summary: simple auth scheme for pyramid, based on Mako template and sqlalchemy backend
|
|
5
|
-
Home-page: http://www.pingpongstars.it
|
|
6
|
-
Author: pdepmcp
|
|
7
|
-
Author-email: d.cariboni@pingpongstars.it
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: This package aims to give and easy pluggable module to provide authentication and user maintennance in a Pyramid web application.
|
|
10
|
-
It relies the Pyramid+SQLAlchemy+Mako stack. Implementation for other template languages is on the roadmap.
|
|
11
|
-
|
|
12
|
-
To activate the package, in your main *\_\_init\_\_.py* file, inside the main function, add this line:
|
|
13
|
-
```python
|
|
14
|
-
config.include('ppss_auth')
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
SQLAlchemy backend for the creation and usage of 3 main tables:
|
|
19
|
-
- ppss_user - containing basic information about the users (username, hashed password and related data )
|
|
20
|
-
- ppss_group - user groups to allow for easier handling of user groups and permissions
|
|
21
|
-
- ppss_permission - a list of permissions (just an id and a name)
|
|
22
|
-
|
|
23
|
-
When a user login, *essionauthpolicy*is used to store her informations (userid and user groups)
|
|
24
|
-
|
|
25
|
-
ppss_auth use these info from the ini file:
|
|
26
|
-
|
|
27
|
-
- ppss_auth.login_url - url for login. Default to /login
|
|
28
|
-
- ppss_auth.logout_url - url for logout. Default to /logout
|
|
29
|
-
- ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
30
|
-
- 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)
|
|
31
|
-
- 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
|
|
32
|
-
- ppss_auth.post_login_route - name of the route where to send the browser after user logged in. Default to Home. Ignored if ppss_auth.post_login_follow is set to true AND there is a referer to go to.
|
|
33
|
-
- ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
34
|
-
- ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
35
|
-
- ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
36
|
-
- ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
37
|
-
- ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
38
|
-
- ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
to init the Tables, in the initialization script (usually in *scripts/intializedb.py*), add this row:
|
|
42
|
-
```python
|
|
43
|
-
from ppss_auth import (models as ppssmodels)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
While creating the default data you use something like:
|
|
47
|
-
```python
|
|
48
|
-
ppssmodels.initdb(dbsession,createdefault=False)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This creates the tables and, if createdefault evaulates to True, it create a default admin/admin user with the admin permission.
|
|
52
|
-
Please change the password to avoid secuirity issues.
|
|
53
|
-
Use the setPassword method on PPSsuser instances to change the password, providing the new password.
|
|
54
|
-
Keywords: pyramid module authentication accelerator
|
|
55
|
-
Platform: UNKNOWN
|
|
56
|
-
Classifier: Development Status :: 4 - Beta
|
|
57
|
-
Classifier: Intended Audience :: Developers
|
|
58
|
-
Classifier: Programming Language :: Python :: 2
|
|
59
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
60
|
-
Requires-Python: >=2.7, <3
|
|
61
|
-
Description-Content-Type: text/markdown
|
ppss_auth-0.6.3/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
This package aims to give and easy pluggable module to provide authentication and user maintennance in a Pyramid web application.
|
|
2
|
-
It relies the Pyramid+SQLAlchemy+Mako stack. Implementation for other template languages is on the roadmap.
|
|
3
|
-
|
|
4
|
-
To activate the package, in your main *\_\_init\_\_.py* file, inside the main function, add this line:
|
|
5
|
-
```python
|
|
6
|
-
config.include('ppss_auth')
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
SQLAlchemy backend for the creation and usage of 3 main tables:
|
|
11
|
-
- ppss_user - containing basic information about the users (username, hashed password and related data )
|
|
12
|
-
- ppss_group - user groups to allow for easier handling of user groups and permissions
|
|
13
|
-
- ppss_permission - a list of permissions (just an id and a name)
|
|
14
|
-
|
|
15
|
-
When a user login, *essionauthpolicy*is used to store her informations (userid and user groups)
|
|
16
|
-
|
|
17
|
-
ppss_auth use these info from the ini file:
|
|
18
|
-
|
|
19
|
-
- ppss_auth.login_url - url for login. Default to /login
|
|
20
|
-
- ppss_auth.logout_url - url for logout. Default to /logout
|
|
21
|
-
- ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
22
|
-
- 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)
|
|
23
|
-
- 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
|
|
24
|
-
- ppss_auth.post_login_route - name of the route where to send the browser after user logged in. Default to Home. Ignored if ppss_auth.post_login_follow is set to true AND there is a referer to go to.
|
|
25
|
-
- ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
26
|
-
- ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
27
|
-
- ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
28
|
-
- ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
29
|
-
- ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
30
|
-
- ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
to init the Tables, in the initialization script (usually in *scripts/intializedb.py*), add this row:
|
|
34
|
-
```python
|
|
35
|
-
from ppss_auth import (models as ppssmodels)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
While creating the default data you use something like:
|
|
39
|
-
```python
|
|
40
|
-
ppssmodels.initdb(dbsession,createdefault=False)
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
This creates the tables and, if createdefault evaulates to True, it create a default admin/admin user with the admin permission.
|
|
44
|
-
Please change the password to avoid secuirity issues.
|
|
45
|
-
Use the setPassword method on PPSsuser instances to change the password, providing the new password.
|
ppss_auth-0.6.3/changelog.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from password import *
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>Login page</title>
|
|
4
|
-
<link rel="stylesheet" href="${request.static_url('ppss_auth:ppss_auth_static/ppssauth.css')}" type="text/css" />
|
|
5
|
-
<%block name="ppssautcss">
|
|
6
|
-
|
|
7
|
-
</%block>
|
|
8
|
-
</head>
|
|
9
|
-
<body class="ppss_auth">
|
|
10
|
-
${next.body()}
|
|
11
|
-
</body>
|
|
12
|
-
|
|
13
|
-
</html>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ppss-auth
|
|
3
|
-
Version: 0.6.3
|
|
4
|
-
Summary: simple auth scheme for pyramid, based on Mako template and sqlalchemy backend
|
|
5
|
-
Home-page: http://www.pingpongstars.it
|
|
6
|
-
Author: pdepmcp
|
|
7
|
-
Author-email: d.cariboni@pingpongstars.it
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: This package aims to give and easy pluggable module to provide authentication and user maintennance in a Pyramid web application.
|
|
10
|
-
It relies the Pyramid+SQLAlchemy+Mako stack. Implementation for other template languages is on the roadmap.
|
|
11
|
-
|
|
12
|
-
To activate the package, in your main *\_\_init\_\_.py* file, inside the main function, add this line:
|
|
13
|
-
```python
|
|
14
|
-
config.include('ppss_auth')
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
SQLAlchemy backend for the creation and usage of 3 main tables:
|
|
19
|
-
- ppss_user - containing basic information about the users (username, hashed password and related data )
|
|
20
|
-
- ppss_group - user groups to allow for easier handling of user groups and permissions
|
|
21
|
-
- ppss_permission - a list of permissions (just an id and a name)
|
|
22
|
-
|
|
23
|
-
When a user login, *essionauthpolicy*is used to store her informations (userid and user groups)
|
|
24
|
-
|
|
25
|
-
ppss_auth use these info from the ini file:
|
|
26
|
-
|
|
27
|
-
- ppss_auth.login_url - url for login. Default to /login
|
|
28
|
-
- ppss_auth.logout_url - url for logout. Default to /logout
|
|
29
|
-
- ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
30
|
-
- 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)
|
|
31
|
-
- 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
|
|
32
|
-
- ppss_auth.post_login_route - name of the route where to send the browser after user logged in. Default to Home. Ignored if ppss_auth.post_login_follow is set to true AND there is a referer to go to.
|
|
33
|
-
- ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
34
|
-
- ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
35
|
-
- ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
36
|
-
- ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
37
|
-
- ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
38
|
-
- ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
to init the Tables, in the initialization script (usually in *scripts/intializedb.py*), add this row:
|
|
42
|
-
```python
|
|
43
|
-
from ppss_auth import (models as ppssmodels)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
While creating the default data you use something like:
|
|
47
|
-
```python
|
|
48
|
-
ppssmodels.initdb(dbsession,createdefault=False)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This creates the tables and, if createdefault evaulates to True, it create a default admin/admin user with the admin permission.
|
|
52
|
-
Please change the password to avoid secuirity issues.
|
|
53
|
-
Use the setPassword method on PPSsuser instances to change the password, providing the new password.
|
|
54
|
-
Keywords: pyramid module authentication accelerator
|
|
55
|
-
Platform: UNKNOWN
|
|
56
|
-
Classifier: Development Status :: 4 - Beta
|
|
57
|
-
Classifier: Intended Audience :: Developers
|
|
58
|
-
Classifier: Programming Language :: Python :: 2
|
|
59
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
60
|
-
Requires-Python: >=2.7, <3
|
|
61
|
-
Description-Content-Type: text/markdown
|
ppss_auth-0.6.3/setup.cfg
DELETED
ppss_auth-0.6.3/setup.py
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
from setuptools import setup,find_packages
|
|
2
|
-
|
|
3
|
-
longdescription = """
|
|
4
|
-
::
|
|
5
|
-
this package aims to give and easy pluggable module to provide authentication.
|
|
6
|
-
|
|
7
|
-
To activate the package, in your main __init__.py file, inside the main function, add this line:
|
|
8
|
-
|
|
9
|
-
::
|
|
10
|
-
config.include('ppss_auth')
|
|
11
|
-
|
|
12
|
-
::
|
|
13
|
-
|
|
14
|
-
It's based upon sqlalchemy backend for the creation and usage of 3 main tables:
|
|
15
|
-
ppss_user - containing basic information about the users (username, hashed password and related data )
|
|
16
|
-
ppss_group - user groups to allow for easier handling of user groups and permissions
|
|
17
|
-
ppss_permission - a list of permissions (just an id and a name)
|
|
18
|
-
|
|
19
|
-
When a user login, sessionauthpolicy is used to store her informations (userid and user groups)
|
|
20
|
-
|
|
21
|
-
ppss_auth use these info from the ini file:
|
|
22
|
-
|
|
23
|
-
-ppss_auth.adminname - the name of a sueruser. Deafult to "admin"
|
|
24
|
-
-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)
|
|
25
|
-
-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
|
|
26
|
-
-ppss_auth.post_login_route - name of the route where to send the browser after user logged in. Default to Home. Ignored if ppss_auth.post_login_follow is set to true AND there is a referer to go to.
|
|
27
|
-
-ppss_auth.post_logout_route - name of the route where to send the browser after log out. Defaults to home
|
|
28
|
-
-ppss_auth.logintemplate - name of the login template. It defaults to the internal template: "ppss_auth:/templates/login.mako"
|
|
29
|
-
-ppss_auth.changepasswordtemplate - name of the change password template. Defaults to: ppss_auth:/templates/change.mako
|
|
30
|
-
-ppss_auth.modifyusertemplate - Defaults to: ppss_auth:/templates/modifyuser.mako
|
|
31
|
-
-ppss_auth.listusertemplate - Defaults to: ppss_auth:/templates/listuser.mako
|
|
32
|
-
-ppss_auth.logintemplateinherit - Defaults to: ppss_auth:/templates/layout.mako
|
|
33
|
-
|
|
34
|
-
::
|
|
35
|
-
to init the Tables, in the initialization script, add this row:
|
|
36
|
-
from ppss_auth import (models as ppssmodels)
|
|
37
|
-
|
|
38
|
-
while creating the default data you use something like:
|
|
39
|
-
ppssmodels.initdb(dbsession,createdefault=False)
|
|
40
|
-
This creates the tables and, if createdefault evaulates to True, it create a default admin/admin user with the admin permission. Please change the password to avoid secuirity issues
|
|
41
|
-
the method retunrs (adminuser,adminpassword)
|
|
42
|
-
On users use the setPassword method to change the password, providing the new password
|
|
43
|
-
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
import os
|
|
47
|
-
here = os.path.abspath(os.path.dirname(__file__))
|
|
48
|
-
readme = open(os.path.join(here, 'README.md'), 'r').read()
|
|
49
|
-
|
|
50
|
-
setup(name='ppss_auth',
|
|
51
|
-
version='0.6.3',
|
|
52
|
-
description='simple auth scheme for pyramid, based on Mako template and sqlalchemy backend',
|
|
53
|
-
long_description=readme,
|
|
54
|
-
long_description_content_type="text/markdown",
|
|
55
|
-
author='pdepmcp',
|
|
56
|
-
author_email='d.cariboni@pingpongstars.it',
|
|
57
|
-
license='MIT',
|
|
58
|
-
classifiers=[
|
|
59
|
-
'Development Status :: 4 - Beta',
|
|
60
|
-
'Intended Audience :: Developers',
|
|
61
|
-
'Programming Language :: Python :: 2',
|
|
62
|
-
'Programming Language :: Python :: 2.7',
|
|
63
|
-
],
|
|
64
|
-
keywords="pyramid module authentication accelerator",
|
|
65
|
-
python_requires='>=2.7, <3',
|
|
66
|
-
url='http://www.pingpongstars.it',
|
|
67
|
-
|
|
68
|
-
#packages=['src/test1'],
|
|
69
|
-
packages=find_packages(),
|
|
70
|
-
include_package_data=True,
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
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
|