api.admin package¶
Subpackages¶
- api.admin.controller package
- Submodules
- api.admin.controller.admin_auth_services module
- api.admin.controller.analytics_services module
- api.admin.controller.catalog_services module
- api.admin.controller.cdn_services module
- api.admin.controller.collection_library_registrations module
- api.admin.controller.collection_self_tests module
- api.admin.controller.collection_settings module
- api.admin.controller.discovery_service_library_registrations module
- api.admin.controller.discovery_services module
- api.admin.controller.individual_admin_settings module
- api.admin.controller.library_settings module
- api.admin.controller.metadata_service_self_tests module
- api.admin.controller.metadata_services module
- api.admin.controller.patron_auth_service_self_tests module
- api.admin.controller.patron_auth_services module
- api.admin.controller.search_service_self_tests module
- api.admin.controller.self_tests module
- api.admin.controller.sitewide_services module
- api.admin.controller.sitewide_settings module
- api.admin.controller.storage_services module
- api.admin.controller.work_editor module
- Module contents
Submodules¶
api.admin.admin_authentication_provider module¶
api.admin.announcement_list_validator module¶
- class api.admin.announcement_list_validator.AnnouncementListValidator(maximum_announcements=3, minimum_announcement_length=15, maximum_announcement_length=350, default_duration_days=60)[source]¶
Bases:
Validator
- DATE_FORMAT = '%Y-%m-%d'¶
- format_as_string(value)[source]¶
Format the output of validate_announcements for storage in ConfigurationSetting.value
- classmethod validate_date(field, value, minimum=None)[source]¶
Validate a date value.
- Parameters:
field – Name of the field, used in error details.
value – Proposed value for the field.
minimum – The proposed value must not be earlier than this value.
- Returns:
A ProblemDetail if validation fails; otherwise a datetime.date.
api.admin.exceptions module¶
api.admin.geographic_validator module¶
- class api.admin.geographic_validator.GeographicValidator[source]¶
Bases:
Validator
- ask_registry(service_area_object, db, do_get=<bound method HTTP.debuggable_get of <class 'core.util.http.HTTP'>>)[source]¶
api.admin.google_oauth_admin_authentication_provider module¶
- class api.admin.google_oauth_admin_authentication_provider.DummyGoogleClient(email='example@nypl.org')[source]¶
Bases:
object
Mock Google OAuth client for testing
- class Credentials(email)[source]¶
Bases:
object
Mock OAuth2Credentials object for testing
- access_token_expired = False¶
- expired = False¶
- class api.admin.google_oauth_admin_authentication_provider.GoogleOAuthAdminAuthenticationProvider(integration, redirect_uri, test_mode=False)[source]¶
Bases:
AdminAuthenticationProvider
- DESCRIPTION = l'How to Configure a Google OAuth Integration'¶
- DOMAINS = 'domains'¶
- INSTRUCTIONS = l'<p>Configuring a Google OAuth integration in the Circulation Manager will allow admins to sign into the Admin interface with their Google/GMail credentials.</p><p>Configure the Google OAuth Service: </p><ol><li>To use this integration, visit the <a href='https://console.developers.google.com/apis/dashboard?pli=1' rel='noopener' rel='noreferer' target='_blank'>Google developer console.</a> Create a project, click 'Create Credentials' in the left sidebar, and select 'OAuth client ID'. If you get a warning about the consent screen, click 'Configure consent screen' and enter your library name as the product name. Save the consent screen information.</li><li>Choose 'Web Application' as the application type.</li><li>Leave 'Authorized JavaScript origins' blank, but under 'Authorized redirect URIs', add the url of your circulation manager followed by '/admin/GoogleAuth/callback', e.g. 'http://mycircmanager.org/admin/GoogleAuth/callback'.</li><li>Click create, and you'll get a popup with your new client ID and secret. Copy these values and enter them in the form below.</li></ol>'¶
- LIBRARY_SETTINGS = [{'key': 'domains', 'label': l'Allowed Domains', 'description': l'Anyone who logs in with an email address from one of these domains will automatically have librarian-level access to this library. Library manager roles must still be granted individually by other admins. If you want to set up admins individually but still allow them to log in with Google, you can create the admin authentication service without adding any libraries.', 'type': 'list'}]¶
- NAME = 'Google OAuth'¶
- SETTINGS = [{'key': 'url', 'label': l'Authentication URI', 'default': 'https://accounts.google.com/o/oauth2/auth', 'required': True, 'format': 'url'}, {'key': 'username', 'label': l'Client ID', 'required': True}, {'key': 'password', 'label': l'Client Secret', 'required': True}]¶
- SITEWIDE = True¶
- TEMPLATE = "\n <a style='\n background: #1B7FA7;\n text-align: center;\n text-decoration: none;\n border-color: #1B7FA7;\n border-radius: .25em;\n color: #fff;\n padding: 10px;\n font-size: 1rem;\n cursor: pointer;\n display: block;\n width: 25vw;\n margin: 2vh auto;\n' href=%(auth_uri)s>Sign in with Google</a>\n "¶
- property client¶
- property domains¶
api.admin.opds module¶
- class api.admin.opds.AdminAnnotator(circulation, library, test_mode=False)[source]¶
Bases:
LibraryAnnotator
- annotate_feed(feed)[source]¶
Make any custom modifications necessary to integrate this OPDS feed into the application’s workflow.
- annotate_work_entry(work, active_license_pool, edition, identifier, feed, entry)[source]¶
Make any custom modifications necessary to integrate this OPDS entry into the application’s workflow.
- Work:
The Work whose OPDS entry is being annotated.
- Active_license_pool:
Of all the LicensePools associated with this Work, the client has expressed interest in this one.
- Edition:
The Edition to use when associating bibliographic metadata with this entry. You will probably not need to use this, because bibliographic metadata was associated with the entry when it was created.
- Identifier:
Of all the Identifiers associated with this Work, the client has expressed interest in this one.
- Parameters:
feed – An OPDSFeed – the feed in which this entry will be situated.
entry – An lxml Element object, the entry that will be added to the feed.
api.admin.password_admin_authentication_provider module¶
- class api.admin.password_admin_authentication_provider.PasswordAdminAuthenticationProvider(integration)[source]¶
Bases:
AdminAuthenticationProvider
- NAME = 'Password Auth'¶
- TEMPLATE = '\n<form action="%(password_sign_in_url)s" method="post">\n<input type="hidden" name="redirect" value="%(redirect)s"/>\n<label style="\n font-weight: 700;\n">Email <input type="text" name="email" style="\n border-radius: .25em;\n display: block;\n padding: 10px;\n border: 1px solid #403d37;\n box-shadow: none;\n font-size: 1rem;\n margin: 1vh 0 3vh 0;\n width: 25vw;\n" /></label>\n<label style="\n font-weight: 700;\n">Password <input type="password" name="password" style="\n border-radius: .25em;\n display: block;\n padding: 10px;\n border: 1px solid #403d37;\n box-shadow: none;\n font-size: 1rem;\n margin: 1vh 0 3vh 0;\n width: 25vw;\n" /></label>\n<button type="submit" style="\n background: #1B7FA7;\n border-color: transparent;\n border-radius: .25em;\n color: #fff;\n padding: 10px;\n font-size: 1rem;\n cursor: pointer;\n display: block;\n width: 100%%;\n margin: 2vh auto;\n">Sign In</button>\n</form>'¶
api.admin.problem_details module¶
api.admin.template_styles module¶
api.admin.templates module¶
api.admin.validator module¶
- class api.admin.validator.PatronAuthenticationValidatorFactory[source]¶
Bases:
object
Creates Validator instances for particular authentication protocols
- VALIDATOR_CLASS_NAME = 'Validator'¶
- VALIDATOR_FACTORY = 'validator_factory'¶
- class api.admin.validator.Validator[source]¶
Bases:
object
- validate_email(settings, content)[source]¶
Find any email addresses that the user has submitted, and make sure that they are in a valid format. This method is used by individual_admin_settings and library_settings.