mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
rename plugins dirs
This commit is contained in:
parent
8713091e73
commit
e8f1264954
28 changed files with 31 additions and 31 deletions
55
archivebox/plugins_auth/ldap/apps.py
Normal file
55
archivebox/plugins_auth/ldap/apps.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
__package__ = 'archivebox.plugins_auth.ldap'
|
||||
|
||||
import inspect
|
||||
|
||||
from typing import List, Dict
|
||||
from pathlib import Path
|
||||
from pydantic import InstanceOf
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from pydantic_pkgr import BinProviderName, ProviderLookupDict, SemVer
|
||||
|
||||
from plugantic.base_plugin import BasePlugin
|
||||
from plugantic.base_hook import BaseHook
|
||||
from plugantic.base_binary import BaseBinary, BaseBinProvider
|
||||
|
||||
from plugins_pkg.pip.apps import SYS_PIP_BINPROVIDER, VENV_PIP_BINPROVIDER
|
||||
from .settings import LDAP_CONFIG, LDAP_LIB
|
||||
|
||||
|
||||
###################### Config ##########################
|
||||
|
||||
|
||||
class LdapBinary(BaseBinary):
|
||||
name: str = 'ldap'
|
||||
description: str = 'LDAP Authentication'
|
||||
binproviders_supported: List[InstanceOf[BaseBinProvider]] = [VENV_PIP_BINPROVIDER, SYS_PIP_BINPROVIDER]
|
||||
|
||||
provider_overrides: Dict[BinProviderName, ProviderLookupDict] = {
|
||||
VENV_PIP_BINPROVIDER.name: {
|
||||
"abspath": lambda: LDAP_LIB and Path(inspect.getfile(LDAP_LIB)),
|
||||
"version": lambda: LDAP_LIB and SemVer(LDAP_LIB.__version__),
|
||||
},
|
||||
SYS_PIP_BINPROVIDER.name: {
|
||||
"abspath": lambda: LDAP_LIB and Path(inspect.getfile(LDAP_LIB)),
|
||||
"version": lambda: LDAP_LIB and SemVer(LDAP_LIB.__version__),
|
||||
},
|
||||
}
|
||||
|
||||
LDAP_BINARY = LdapBinary()
|
||||
|
||||
|
||||
class LdapAuthPlugin(BasePlugin):
|
||||
app_label: str = 'ldap'
|
||||
verbose_name: str = 'LDAP Authentication'
|
||||
|
||||
hooks: List[InstanceOf[BaseHook]] = [
|
||||
LDAP_CONFIG,
|
||||
LDAP_BINARY,
|
||||
]
|
||||
|
||||
|
||||
PLUGIN = LdapAuthPlugin()
|
||||
PLUGIN.register(settings)
|
||||
DJANGO_APP = PLUGIN.AppConfig
|
Loading…
Add table
Add a link
Reference in a new issue