Introducing public and private extension_props for users
- public: they will be visible to the world (for example as result of the User.find() query) - private: visible only to their user
This commit is contained in:
parent
98527c72f4
commit
be4ce024f4
@ -129,11 +129,17 @@ users_schema = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
# Properties defined by extensions. Extensions should use their name
|
# Properties defined by extensions. Extensions should use their name (see the
|
||||||
# (see the PillarExtension.name property) as the key, and are free to
|
# PillarExtension.name property) as the key, and are free to use whatever they want as value,
|
||||||
# use whatever they want as value (but we suggest a dict for future
|
# but we suggest a dict for future extendability.
|
||||||
# extendability).
|
# Properties can be of two types:
|
||||||
'extension_props': {
|
# - public: they will be visible to the world (for example as part of the User.find() query)
|
||||||
|
# - private: visible only to their user
|
||||||
|
'extension_props_public': {
|
||||||
|
'type': 'dict',
|
||||||
|
'required': False,
|
||||||
|
},
|
||||||
|
'extension_props_private': {
|
||||||
'type': 'dict',
|
'type': 'dict',
|
||||||
'required': False,
|
'required': False,
|
||||||
},
|
},
|
||||||
|
@ -135,7 +135,7 @@ def after_fetching_user(user):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Remove all fields except public ones.
|
# Remove all fields except public ones.
|
||||||
public_fields = {'full_name', 'username', 'email'}
|
public_fields = {'full_name', 'username', 'email', 'extension_props_public'}
|
||||||
for field in list(user.keys()):
|
for field in list(user.keys()):
|
||||||
if field not in public_fields:
|
if field not in public_fields:
|
||||||
del user[field]
|
del user[field]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user