sanskrit_data.schema.users

Intro

  • For general context and class diagram, refer to schema.
class sanskrit_data.schema.users.AuthenticationInfo[source]

Bases: sanskrit_data.schema.common.JsonObject

VEDAVAAPI_AUTH = 'vedavaapi'
check_password(plain_password)[source]
classmethod from_details(auth_user_id, auth_provider, auth_secret_hashed=None)[source]
schema = {'required': ['jsonClass'], 'type': 'object', 'properties': {'auth_secret_plain': {'type': 'string', 'description': 'This should NEVER be set when stored in a database; but is good for client-server transmission purposes.'}, 'auth_provider': {'enum': ['google', 'vedavaapi'], 'type': 'string'}, 'auth_user_id': {'type': 'string'}, 'auth_secret_bcrypt': {'type': 'string', 'description': 'This should be hashed, and merits being stored in a database.'}, 'jsonClass': {'enum': ['AuthenticationInfo'], 'type': 'string'}}}
set_bcrypt_password()[source]
validate_schema()[source]
class sanskrit_data.schema.users.User[source]

Bases: sanskrit_data.schema.common.JsonObject

Represents a user of our service.

check_permission(service, action)[source]
classmethod from_details(user_type, auth_infos, permissions=None)[source]
get_user_ids()[source]
schema = {'required': ['jsonClass'], 'type': 'object', 'properties': {'jsonClass': {'enum': ['User'], 'type': 'string'}, 'user_type': {'enum': ['human', 'bot'], 'type': 'string'}, 'authentication_infos': {'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'auth_secret_plain': {'type': 'string', 'description': 'This should NEVER be set when stored in a database; but is good for client-server transmission purposes.'}, 'auth_provider': {'enum': ['google', 'vedavaapi'], 'type': 'string'}, 'auth_user_id': {'type': 'string'}, 'auth_secret_bcrypt': {'type': 'string', 'description': 'This should be hashed, and merits being stored in a database.'}, 'jsonClass': {'enum': ['AuthenticationInfo'], 'type': 'string'}}}, 'type': 'array'}, 'permissions': {'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'actions': {'items': {'enum': ['read', 'write', 'admin'], 'type': 'string'}, 'type': 'array', 'description': 'Should be an enum in the future.'}, 'service': {'enum': ['.*', 'ullekhanam'], 'type': 'string', 'description': 'Allowable values should be predetermined regular expressions.'}, 'jsonClass': {'enum': ['UserPermission'], 'type': 'string'}}}, 'type': 'array'}}}
validate_schema()[source]
class sanskrit_data.schema.users.UserPermission[source]

Bases: sanskrit_data.schema.common.JsonObject

classmethod from_details(service, actions)[source]
schema = {'required': ['jsonClass'], 'type': 'object', 'properties': {'service': {'enum': ['.*', 'ullekhanam'], 'type': 'string', 'description': 'Allowable values should be predetermined regular expressions.'}, 'actions': {'items': {'enum': ['read', 'write', 'admin'], 'type': 'string'}, 'type': 'array', 'description': 'Should be an enum in the future.'}, 'jsonClass': {'enum': ['UserPermission'], 'type': 'string'}}}
sanskrit_data.schema.users.hash_password(plain_password)[source]