assembl.models.auth module¶
All classes relative to users and their online identities.
-
class
assembl.models.auth.
AbstractAgentAccount
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
An abstract class for online accounts that identify AgentsProfiles
The main subclasses are
EmailAccount
andsocial_auth.SocialAuthAccount
.-
classmethod
restrict_to_owners_condition
(query, user_id, alias=None, alias_maker=None)[source]¶ filter query according to object owners
-
update_from_json
(json, user_id=None, context=None, object_importer=None, permissions=None, parse_def_name='default_reverse')[source]¶ Update (patch) an object from its JSON representation.
-
classmethod
-
class
assembl.models.auth.
AgentProfile
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
An agent identified on the platform.
Agents can be
User
or simply the author of an imported message; they could also be a group, bot or computer. Agents have at least oneAbstractAgentAccount
.-
login_expiry
(discussion=None)[source]¶ When will this account’s login expire, maybe in the context of a specific discussion.
-
merge
(other_profile)[source]¶ Merge another profile on this profile, because they are the same entity.
This identity is usually found out after an email account is verified, or a social account is added to another account. All foreign keys that refer to the other agent profile must now refer to this one.
-
-
class
assembl.models.auth.
AgentStatusInDiscussion
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
Information about a user’s activity in a discussion
Whether the user has logged in and is subscribed to notifications.
-
class
assembl.models.auth.
AnonymousUser
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
,assembl.models.auth.User
A fake anonymous user bound to a source.
-
class
assembl.models.auth.
EmailAccount
(**kwargs)[source]¶ Bases:
assembl.models.auth.AbstractAgentAccount
An email account
-
unique_query
()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-
-
class
assembl.models.auth.
IdentityProvider
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
An identity provider (or sometimes a category of identity providers.)
This is a service that provides online identities, expressed as
social_auth.SocialAuthAccount
.
-
class
assembl.models.auth.
LanguagePreferenceCollection
[source]¶ Bases:
object
A collection of
UserLanguagePreference
, allowing to decide on which languages to display.
-
class
assembl.models.auth.
LanguagePreferenceCollectionWithDefault
(locale_code)[source]¶ Bases:
assembl.models.auth.LanguagePreferenceCollection
A LanguagePreferenceCollection with a fallback language.
-
class
assembl.models.auth.
LanguagePreferenceOrder
(value)[source]¶ Bases:
enum.IntEnum
An enumeration.
-
class
assembl.models.auth.
PartnerOrganization
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
A corporate entity that we want to display in the discussion’s page
-
classmethod
get_discussion_conditions
(discussion_id, alias_maker=None)[source]¶ Returns a list of SQLA expressions that constrain a query on this class to a given discussion.
-
populate_from_context
(context)[source]¶ If object created in this context, populate some relations from that context.
This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.
-
unique_query
()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-
classmethod
-
class
assembl.models.auth.
User
(**kwargs)[source]¶ Bases:
assembl.models.NamedClassMixin
,assembl.lib.history_mixin.OriginMixin
,assembl.models.auth.AgentProfile
A user of the platform.
-
get_notification_subscriptions
(discussion_id, reset_defaults=False, request=None, on_thread=True)[source]¶ the notification subscriptions for this user and discussion. Includes materialized subscriptions from the template.
-
get_notification_subscriptions_for_current_discussion
()[source]¶ CAN ONLY BE CALLED WITH A CURRENT REQUEST
-
merge
(other_user)[source]¶ Merge another user on this one, because they are the same entity.
This identity is usually found out after an email account is verified, or a social account is added to another account. All foreign keys that refer to the other user must now refer to this one.
-
-
class
assembl.models.auth.
UserLanguagePreference
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Does this user wants data in this language to be displayed or translated?
-
unique_query
()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-
-
class
assembl.models.auth.
UserLanguagePreferenceCollection
(user_id)[source]¶ Bases:
assembl.models.auth.LanguagePreferenceCollection
A LanguagePreferenceCollection that represent one user’s preferences.