Installation
pip install ckanext-let-me-in
Core Plugin
ckan.plugins = … let_me_in …
Mit Impostor Subplugin (NUR für Test/Dev!)
ckan.plugins = … let_me_in let_me_in_impostor …
DB Migration (nur für Impostor)
ckan db upgrade -p let_me_in_impostor
Konfiguration:
OTL Link TTL (Sekunden, Standard: 86400 = 24h)
ckanext.let_me_in.otl_link_ttl = 3600
Route nach Login (optional)
ckan.auth.route_after_login = dashboard.datasets
Impostor Session TTL (Sekunden, Standard: 900 = 15min)
ckanext.let_me_in.impostor.ttl = 1800
Toolbar-Button für Impostor anzeigen (Standard: true)
ckanext.let_me_in.impostor.show_toolbar_button = true
Session Records pro Seite (Standard: 10)
ckanext.let_me_in.impostor.session_records_per_page = 20
CLI Usage:
OTL per User-ID generieren
ckan letmein uli –uid=0daa9f1d-671a-49f3-a7a6-15f4a263ef49
OTL per Username
ckan letmein uli –name=rsmith
OTL per Email
ckan letmein uli –mail=rsmith@example.com
OTL mit custom TTL (in Sekunden)
ckan letmein uli –name=rsmith –ttl=7200
API Usage:
result = tk.get_action(‘lmi_generate_otl’)(
context,
{
‘uid’: ‘rsmith’, # oder ‘name’ oder ‘mail’
‘ttl’: 3600 # optional
}
)
Returns: {‘token’: ‘jwt-token’, ‘url’: ‘http://…’, ‘user’: {…}}
ILetMeIn Interface Implementation:
class MyPlugin(p.SingletonPlugin):
p.implements(ILetMeIn)
def manage_user(self, user, context):
# Reaktiviere gesperrte User vor Login
if user.state != model.State.ACTIVE:
user.state = model.State.ACTIVE
model.Session.commit()
return user
def before_otl_login(self, user, context):
# Custom Logging
log.info(f"User {user.name} logging in via OTL")
def after_otl_login(self, user, context):
# Send welcome email
send_email(user.email, 'Welcome back!')