Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set option for allowing only certain domains to register #1086

Merged
merged 9 commits into from
Oct 19, 2024

Conversation

yatesdr
Copy link
Contributor

@yatesdr yatesdr commented Oct 18, 2024

  1. Create a key ALLOWED_DOMAINS_FOR_USER_REGISTRATION, default as an empty list in settings.py
  2. Apply the key in the E-mail registration validation function to supersede the RESTRICTED_DOMAINS.... setting only if there are items in the new list.

Add an optional ALLOWED_DOMAINS_FOR_USER_REGISTRATION key.
@yatesdr yatesdr changed the title #1085 - Set option for allowing only certain domains to register Set option for allowing only certain domains to register Oct 18, 2024
cms/settings.py Outdated Show resolved Hide resolved
users/adapter.py Outdated
@@ -10,6 +10,10 @@ def get_email_confirmation_url_stub(self, request, emailconfirmation):
return settings.SSL_FRONTEND_HOST + url

def clean_email(self, email):
if len(settings.ALLOWED_DOMAINS_FOR_USER_REGISTRATION):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to query for this more defensively, eg like this


if hasattr(settings, "ALLOWED_DOMAINS_FOR_USER_REGISTRATION") ...

this ensures that settings won't break with an AttributeError in case it's missing in settings.py

Also no need to check with len() explicitly, the same can be through:

if hasattr(settings, "ALLOWED_DOMAINS_FOR_USER_REGISTRATION") and settings.ALLOWED_DOMAINS_FOR_USER_REGISTRATION: 

@mgogoulos
Copy link
Contributor

Great, I made some minor suggestions, if you can check them. Also can you add a small entry in https://github.com/mediacms-io/mediacms/blob/main/docs/admins_docs.md ? This doc is not a good way of keeping documentation but it's better than nothing :)

Defensively check for attribute before querying.
Short documentation for ALLOWED_DOMAINS_FOR_USER_REGISTRATION addition.
@yatesdr
Copy link
Contributor Author

yatesdr commented Oct 18, 2024

Good feedback, all complete now.

@mgogoulos mgogoulos merged commit 673ddeb into mediacms-io:main Oct 19, 2024
1 of 2 checks passed
@mgogoulos
Copy link
Contributor

Merged, thanks for the PR, feel free to contribute to other parts too :)

@yatesdr
Copy link
Contributor Author

yatesdr commented Oct 19, 2024

Merged, thanks for the PR, feel free to contribute to other parts too :)

Happy to contribute, there's a couple other minor features I'm examining, but not sure if they'd be of use or if I have the skillset to properly implement them.

My current use-case is as a back-end media manager to Canvas, an online learning platform, to host videos that are often not licensed to be shared publicly. To facilitate this use-case, the two main features I'm looking into are:

  1. Create an option for a "clean embed", with just a play button. The default embed player includes social aspects I'd prefer not to have in the corners such as share and the video information. Currently, it's easy enough to override these features in the CSS bundle and it's good enough, but it may be useful for other people to also have this available as a configuration or separate "clean embed" link that simply provides the clean stream and basic controls.

  2. Investigate adding some type of auth protection for streams to help limit external sharing of private content. This is necessary because a number of the videos we use for training are copyrighted, and simply having them unlisted is a potential issue. It of course works fine if GLOBAL_LOGIN is enabled, but when integrating with a 3rd party application that can't directly log-in I'm not clear on if there's currently a way to permit the stream only to the intended application. The log-in and auth for end-users of the educational platform is already handled, so I believe setting an endpoint and auth token from the platform may be enough to accomplish this, but don't have a good bead on how to integrate it yet.

Thanks again!

D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants