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.BaseAn abstract class for online accounts that identify AgentsProfiles
The main subclasses are
EmailAccountandsocial_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.BaseAn agent identified on the platform.
Agents can be
Useror 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.DiscussionBoundBaseInformation 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.UserA fake anonymous user bound to a source.
-
class
assembl.models.auth.EmailAccount(**kwargs)[source]¶ Bases:
assembl.models.auth.AbstractAgentAccountAn 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.BaseAn 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:
objectA collection of
UserLanguagePreference, allowing to decide on which languages to display.
-
class
assembl.models.auth.LanguagePreferenceCollectionWithDefault(locale_code)[source]¶ Bases:
assembl.models.auth.LanguagePreferenceCollectionA LanguagePreferenceCollection with a fallback language.
-
class
assembl.models.auth.LanguagePreferenceOrder(value)[source]¶ Bases:
enum.IntEnumAn enumeration.
-
class
assembl.models.auth.PartnerOrganization(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBaseA 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.AgentProfileA 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.BaseDoes 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.LanguagePreferenceCollectionA LanguagePreferenceCollection that represent one user’s preferences.