kinto 19.5.0__py3-none-any.whl → 20.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of kinto might be problematic. Click here for more details.
- kinto/__main__.py +0 -17
- kinto/config/kinto.tpl +0 -13
- kinto/contribute.json +27 -0
- kinto/core/__init__.py +3 -3
- kinto/core/cornice/__init__.py +93 -0
- kinto/core/cornice/cors.py +144 -0
- kinto/core/cornice/errors.py +40 -0
- kinto/core/cornice/pyramidhook.py +373 -0
- kinto/core/cornice/renderer.py +89 -0
- kinto/core/cornice/resource.py +205 -0
- kinto/core/cornice/service.py +641 -0
- kinto/core/cornice/util.py +138 -0
- kinto/core/cornice/validators/__init__.py +94 -0
- kinto/core/cornice/validators/_colander.py +142 -0
- kinto/core/cornice/validators/_marshmallow.py +182 -0
- kinto/core/cornice_swagger/__init__.py +92 -0
- kinto/core/cornice_swagger/converters/__init__.py +21 -0
- kinto/core/cornice_swagger/converters/exceptions.py +6 -0
- kinto/core/cornice_swagger/converters/parameters.py +90 -0
- kinto/core/cornice_swagger/converters/schema.py +249 -0
- kinto/core/cornice_swagger/swagger.py +725 -0
- kinto/core/cornice_swagger/templates/index.html +73 -0
- kinto/core/cornice_swagger/templates/index_script_template.html +21 -0
- kinto/core/cornice_swagger/util.py +42 -0
- kinto/core/cornice_swagger/views.py +78 -0
- kinto/core/initialization.py +0 -14
- kinto/core/openapi.py +2 -3
- kinto/core/resource/viewset.py +1 -1
- kinto/core/storage/postgresql/pool.py +1 -1
- kinto/core/testing.py +1 -1
- kinto/core/utils.py +3 -2
- kinto/core/views/batch.py +1 -1
- kinto/core/views/errors.py +2 -0
- kinto/core/views/openapi.py +1 -1
- kinto/plugins/accounts/__init__.py +2 -19
- kinto/plugins/accounts/authentication.py +8 -54
- kinto/plugins/accounts/utils.py +0 -133
- kinto/plugins/accounts/{views/__init__.py → views.py} +7 -62
- kinto/plugins/admin/VERSION +1 -1
- kinto/plugins/admin/build/VERSION +1 -1
- kinto/plugins/admin/build/assets/asn1-EdZsLKOL.js +1 -0
- kinto/plugins/admin/build/assets/index-Bq62Gei8.js +165 -0
- kinto/plugins/admin/build/assets/{index-BdpYyatM.css → index-Cs7JVwIg.css} +1 -1
- kinto/plugins/admin/build/assets/javascript-qCveANmP.js +1 -0
- kinto/plugins/admin/build/assets/mllike-CXdrOF99.js +1 -0
- kinto/plugins/admin/build/assets/sql-D0XecflT.js +1 -0
- kinto/plugins/admin/build/assets/ttcn-cfg-B9xdYoR4.js +1 -0
- kinto/plugins/admin/build/index.html +2 -2
- kinto/plugins/flush.py +1 -1
- kinto/plugins/openid/views.py +1 -1
- kinto/views/contribute.py +14 -13
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/METADATA +2 -6
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/RECORD +57 -42
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/WHEEL +1 -1
- kinto/plugins/accounts/mails.py +0 -96
- kinto/plugins/accounts/views/validation.py +0 -136
- kinto/plugins/admin/build/assets/asn1-CGOzndHr.js +0 -1
- kinto/plugins/admin/build/assets/index-n-QM_iZE.js +0 -165
- kinto/plugins/admin/build/assets/javascript-iSgyE4tI.js +0 -1
- kinto/plugins/admin/build/assets/mllike-C_8OmSiT.js +0 -1
- kinto/plugins/admin/build/assets/sql-C4g8LzGK.js +0 -1
- kinto/plugins/admin/build/assets/ttcn-cfg-BIkV9KBc.js +0 -1
- kinto/plugins/quotas/__init__.py +0 -21
- kinto/plugins/quotas/listener.py +0 -226
- kinto/plugins/quotas/scripts.py +0 -80
- kinto/plugins/quotas/utils.py +0 -7
- kinto/scripts.py +0 -41
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/LICENSE +0 -0
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/entry_points.txt +0 -0
- {kinto-19.5.0.dist-info → kinto-20.0.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import re
|
|
2
|
-
import uuid
|
|
3
|
-
|
|
4
1
|
import colander
|
|
5
2
|
from pyramid import httpexceptions
|
|
6
3
|
from pyramid.authorization import Authenticated, Everyone
|
|
@@ -8,22 +5,12 @@ from pyramid.decorator import reify
|
|
|
8
5
|
from pyramid.events import subscriber
|
|
9
6
|
from pyramid.settings import aslist
|
|
10
7
|
|
|
11
|
-
from kinto.core import resource
|
|
8
|
+
from kinto.core import resource, utils
|
|
12
9
|
from kinto.core.errors import http_error, raise_invalid
|
|
13
10
|
from kinto.core.events import ACTIONS, ResourceChanged
|
|
14
11
|
from kinto.views import NameGenerator
|
|
15
12
|
|
|
16
|
-
from
|
|
17
|
-
from ..utils import (
|
|
18
|
-
ACCOUNT_POLICY_NAME,
|
|
19
|
-
cache_validation_key,
|
|
20
|
-
delete_cached_account,
|
|
21
|
-
get_cached_validation_key,
|
|
22
|
-
hash_password,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
DEFAULT_EMAIL_REGEXP = "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$"
|
|
13
|
+
from .utils import ACCOUNT_CACHE_KEY, ACCOUNT_POLICY_NAME, hash_password
|
|
27
14
|
|
|
28
15
|
|
|
29
16
|
def _extract_posted_body_id(request):
|
|
@@ -63,13 +50,6 @@ class Account(resource.Resource):
|
|
|
63
50
|
)
|
|
64
51
|
# Shortcut to check if current is anonymous (before get_parent_id()).
|
|
65
52
|
context.is_anonymous = Authenticated not in request.effective_principals
|
|
66
|
-
# Is the "accounts validation" setting set?
|
|
67
|
-
context.validation_enabled = settings.get("account_validation", False)
|
|
68
|
-
# Account validation requires the user id to be an email.
|
|
69
|
-
validation_email_regexp = settings.get(
|
|
70
|
-
"account_validation.email_regexp", DEFAULT_EMAIL_REGEXP
|
|
71
|
-
)
|
|
72
|
-
context.validation_email_regexp = re.compile(validation_email_regexp)
|
|
73
53
|
|
|
74
54
|
super().__init__(request, context)
|
|
75
55
|
|
|
@@ -122,26 +102,6 @@ class Account(resource.Resource):
|
|
|
122
102
|
error_details = {"name": "data.id", "description": "Accounts must have an ID."}
|
|
123
103
|
raise_invalid(self.request, **error_details)
|
|
124
104
|
|
|
125
|
-
# Account validation requires that the record ID is an email address.
|
|
126
|
-
# TODO: this might be better suited for a schema. Do we have a way to
|
|
127
|
-
# dynamically change the schema according to the settings?
|
|
128
|
-
if self.context.validation_enabled and old is None:
|
|
129
|
-
email_regexp = self.context.validation_email_regexp
|
|
130
|
-
# Account validation requires that the record ID is an email address.
|
|
131
|
-
user_email = new[self.model.id_field]
|
|
132
|
-
if not email_regexp.match(user_email):
|
|
133
|
-
error_details = {
|
|
134
|
-
"name": "data.id",
|
|
135
|
-
"description": f"Account validation is enabled, and user id should match {email_regexp}",
|
|
136
|
-
}
|
|
137
|
-
raise_invalid(self.request, **error_details)
|
|
138
|
-
|
|
139
|
-
activation_key = str(uuid.uuid4())
|
|
140
|
-
new["validated"] = False
|
|
141
|
-
|
|
142
|
-
# Store the activation key in the cache to be used in the `validate` endpoint.
|
|
143
|
-
cache_validation_key(activation_key, new["id"], self.request.registry)
|
|
144
|
-
|
|
145
105
|
# Administrators can reach other accounts and anonymous have no
|
|
146
106
|
# selected_userid. So do not try to enforce.
|
|
147
107
|
if self.context.is_administrator or self.context.is_anonymous:
|
|
@@ -164,28 +124,13 @@ class Account(resource.Resource):
|
|
|
164
124
|
)
|
|
165
125
|
def on_account_changed(event):
|
|
166
126
|
request = event.request
|
|
127
|
+
cache = request.registry.cache
|
|
128
|
+
settings = request.registry.settings
|
|
129
|
+
hmac_secret = settings["userid_hmac_secret"]
|
|
167
130
|
|
|
168
131
|
for obj in event.impacted_objects:
|
|
169
132
|
# Extract username and password from current user
|
|
170
133
|
username = obj["old"]["id"]
|
|
134
|
+
cache_key = utils.hmac_digest(hmac_secret, ACCOUNT_CACHE_KEY.format(username))
|
|
171
135
|
# Delete cache
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
# Send activation code by email on account creation if account validation is enabled.
|
|
176
|
-
@subscriber(ResourceChanged, for_resources=("account",), for_actions=(ACTIONS.CREATE,))
|
|
177
|
-
def on_account_created(event):
|
|
178
|
-
request = event.request
|
|
179
|
-
settings = request.registry.settings
|
|
180
|
-
if not settings.get("account_validation", False):
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
for impacted_object in event.impacted_objects:
|
|
184
|
-
account = impacted_object["new"]
|
|
185
|
-
user_email = account["id"]
|
|
186
|
-
activation_key = get_cached_validation_key(user_email, request.registry)
|
|
187
|
-
if activation_key is None:
|
|
188
|
-
continue
|
|
189
|
-
|
|
190
|
-
# Send an email to the user with the link to activate their account.
|
|
191
|
-
Emailer(request, account).send_activation(activation_key)
|
|
136
|
+
cache.delete(cache_key)
|
kinto/plugins/admin/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.6.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.6.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(i){for(var s={},c=i.split(" "),T=0;T<c.length;++T)s[c[T]]=!0;return s}const o={keywords:u("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS MINACCESS MAXACCESS REVISION STATUS DESCRIPTION SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY IMPLIED EXPORTS"),cmipVerbs:u("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),compareTypes:u("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL TEXTUAL-CONVENTION"),status:u("current deprecated mandatory obsolete"),tags:u("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS UNIVERSAL"),storage:u("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING UTCTime InterfaceIndex IANAifType CMIP-Attribute REAL PACKAGE PACKAGES IpAddress PhysAddress NetworkAddress BITS BMPString TimeStamp TimeTicks TruthValue RowStatus DisplayString GeneralString GraphicString IA5String NumericString PrintableString SnmpAdminString TeletexString UTF8String VideotexString VisibleString StringStore ISO646String T61String UniversalString Unsigned32 Integer32 Gauge Gauge32 Counter Counter32 Counter64"),modifier:u("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS DEFINED"),accessTypes:u("not-accessible accessible-for-notify read-only read-create read-write"),multiLineStrings:!0};function g(i){var s=i.keywords||o.keywords,c=i.cmipVerbs||o.cmipVerbs,T=i.compareTypes||o.compareTypes,N=i.status||o.status,d=i.tags||o.tags,f=i.storage||o.storage,m=i.modifier||o.modifier,C=i.accessTypes||o.accessTypes;i.multiLineStrings||o.multiLineStrings;var R=i.indentStatements!==!1,A=/[\|\^]/,E;function y(e,n){var t=e.next();if(t=='"'||t=="'")return n.tokenize=D(t),n.tokenize(e,n);if(/[\[\]\(\){}:=,;]/.test(t))return E=t,"punctuation";if(t=="-"&&e.eat("-"))return e.skipToEnd(),"comment";if(/\d/.test(t))return e.eatWhile(/[\w\.]/),"number";if(A.test(t))return e.eatWhile(A),"operator";e.eatWhile(/[\w\-]/);var r=e.current();return s.propertyIsEnumerable(r)?"keyword":c.propertyIsEnumerable(r)?"variableName":T.propertyIsEnumerable(r)?"atom":N.propertyIsEnumerable(r)?"comment":d.propertyIsEnumerable(r)?"typeName":f.propertyIsEnumerable(r)||m.propertyIsEnumerable(r)||C.propertyIsEnumerable(r)?"modifier":"variableName"}function D(e){return function(n,t){for(var r=!1,S,O=!1;(S=n.next())!=null;){if(S==e&&!r){var I=n.peek();I&&(I=I.toLowerCase(),(I=="b"||I=="h"||I=="o")&&n.next()),O=!0;break}r=!r&&S=="\\"}return O&&(t.tokenize=null),"string"}}function p(e,n,t,r,S){this.indented=e,this.column=n,this.type=t,this.align=r,this.prev=S}function a(e,n,t){var r=e.indented;return e.context&&e.context.type=="statement"&&(r=e.context.indented),e.context=new p(r,n,t,null,e.context)}function l(e){var n=e.context.type;return(n==")"||n=="]"||n=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}return{name:"asn1",startState:function(){return{tokenize:null,context:new p(-2,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,n){var t=n.context;if(e.sol()&&(t.align==null&&(t.align=!1),n.indented=e.indentation(),n.startOfLine=!0),e.eatSpace())return null;E=null;var r=(n.tokenize||y)(e,n);if(r=="comment")return r;if(t.align==null&&(t.align=!0),(E==";"||E==":"||E==",")&&t.type=="statement")l(n);else if(E=="{")a(n,e.column(),"}");else if(E=="[")a(n,e.column(),"]");else if(E=="(")a(n,e.column(),")");else if(E=="}"){for(;t.type=="statement";)t=l(n);for(t.type=="}"&&(t=l(n));t.type=="statement";)t=l(n)}else E==t.type?l(n):R&&((t.type=="}"||t.type=="top")&&E!=";"||t.type=="statement"&&E=="newstatement")&&a(n,e.column(),"statement");return n.startOfLine=!1,r},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"--"}}}}export{g as asn1};
|