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

Domains as env var #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ For now, here is the very rough documentation:
- See https://developers.google.com/api-client-library/php/auth/web-app
- place the client secrets file inside the google-auth/ plugin directory
4. This plugin allows you to filter access based on domain (i.e. only @mydomain.com addresses)
- Edit define('APPROVED_DOMAIN', "mydomain.com");
- If you want anyone with a Google account to get in (you probably don't want that), set to *
- i.e. define('APPROVED_DOMAIN', "*");
- Set the domains as an env variable, e.g.
`export APPROVED_DOMAINS="one_domain.com,another_domain.com,a_third_domain.com"`
- Alternatively, you can hard-code the domains directly on line 89 of plugin.php
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function atomarch_check_domain($google_client) {

// List of domains that have permission to login. Use "*"" to allow access from any google account
//$APPROVED_DOMAINS = array("domain1.com", "domain2.com");
$APPROVED_DOMAINS = array("*");
$APPROVED_DOMAINS = array_map("trim", explode(",", getenv('APPROVED_DOMAINS')) ?: "*");

if (in_array("*", $APPROVED_DOMAINS)) {
return true;
Expand Down