Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
nkottary committed Apr 14, 2021
commit 9942b144e6dcd158378f70b5e98646b971a90a60
8 changes: 4 additions & 4 deletions src/webui/gitutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ is_success(res::AuthSuccess) = true
is_success(res::AuthFailure) = false

const AUTH_REG_FILE = "authorized_registrars.txt"
const AUTH_FILE_NOT_FOUND_ERROR = "`$auth_reg_file` was not found in this repository"
const AUTH_FILE_NOT_FOUND_ERROR = "`$AUTH_REG_FILE` was not found in this repository"
const EMAIL_ID_NOT_PUBLIC = "Please make your email ID public in your GitHub/GitLab settings page"
const USER_NOT_IN_AUTH_LIST_ERROR = "Your email ID is not in the $auth_reg_file of this repository"
const USER_NOT_IN_AUTH_LIST_ERROR = "Your email ID is not in the $AUTH_REG_FILE of this repository"

get_repo_owner_id(repo::GitLab.Project) = repo.owner === nothing ? nothing : repo.owner.username
get_repo_owner_id(repo::GitHub.Repo) = repo.owner === nothing ? nothing : repo.owner.login
Expand Down Expand Up @@ -79,7 +79,7 @@ function isauthorized(u::User{GitHub.User}, repo::GitHub.Repo; ref::AbstractStri

if u.user.login == get_repo_owner_id(repo)
return AuthSuccess()
elseif get(CONFIG, "authtype", "authfile") == "authfile"
elseif get(CONFIG, "authtype", "") == "authfile"
return authorize_user_from_file(forge, u, repo, ref)
elseif repo.organization === nothing
hasauth = @gf @mock is_collaborator(forge, repo.owner.login, repo.name, u.user.login)
Expand Down Expand Up @@ -114,7 +114,7 @@ function isauthorized(u::User{GitLab.User}, repo::GitLab.Project; ref::AbstractS

if u.user.id == get_repo_owner_id(repo)
return AuthSuccess()
elseif get(CONFIG, "authtype", "authfile") == "authfile"
elseif get(CONFIG, "authtype", "") == "authfile"
return authorize_user_from_file(forge, u, repo, ref)
elseif repo.namespace.kind == "user"
hasauth = @gf @mock is_collaborator(forge, repo.owner.username, repo.name, u.user.id)
Expand Down