aboutsummaryrefslogtreecommitdiff
path: root/acl.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-19 20:44:54 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-19 20:44:54 +0800
commit294d06ea4865e4bae88c1dee6a8a841a7f204189 (patch)
tree9d80c02fc509f43626f220874f46d8e906c0b6dc /acl.go
parentssh/recv: Rename access -> direct_access (diff)
downloadforge-294d06ea4865e4bae88c1dee6a8a841a7f204189.tar.gz
forge-294d06ea4865e4bae88c1dee6a8a841a7f204189.tar.zst
forge-294d06ea4865e4bae88c1dee6a8a841a7f204189.zip
ssh/recv, users, schema: Create pubkey_only users
Diffstat (limited to 'acl.go')
-rw-r--r--acl.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/acl.go b/acl.go
index 095c1f1..7ad48fb 100644
--- a/acl.go
+++ b/acl.go
@@ -6,7 +6,7 @@ import (
// get_path_perm_by_group_repo_key returns the filesystem path and direct
// access permission for a given repo and a provided ssh public key.
-func get_path_perm_by_group_repo_key(ctx context.Context, group_name, repo_name, ssh_pubkey string) (filesystem_path string, access bool, contrib_requirements string, is_registered_user bool, err error) {
+func get_path_perm_by_group_repo_key(ctx context.Context, group_name, repo_name, ssh_pubkey string) (filesystem_path string, access bool, contrib_requirements string, user_type string, err error) {
err = database.QueryRow(ctx,
`SELECT
r.filesystem_path,
@@ -15,10 +15,7 @@ func get_path_perm_by_group_repo_key(ctx context.Context, group_name, repo_name,
ELSE FALSE
END AS has_role_in_group,
r.contrib_requirements,
- CASE
- WHEN u.id IS NOT NULL THEN TRUE
- ELSE FALSE
- END
+ COALESCE(u.type, '')
FROM
groups g
JOIN
@@ -33,6 +30,6 @@ func get_path_perm_by_group_repo_key(ctx context.Context, group_name, repo_name,
g.name = $1
AND r.name = $2;`,
group_name, repo_name, ssh_pubkey,
- ).Scan(&filesystem_path, &access, &contrib_requirements, &is_registered_user)
+ ).Scan(&filesystem_path, &access, &contrib_requirements, &user_type)
return
}