From 294d06ea4865e4bae88c1dee6a8a841a7f204189 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 19 Feb 2025 20:44:54 +0800 Subject: ssh/recv, users, schema: Create pubkey_only users --- acl.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'acl.go') 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 } -- cgit v1.2.3