aboutsummaryrefslogtreecommitdiff
path: root/acl.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-19 21:19:15 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-19 21:19:15 +0800
commit7fb71b36ad50153f6e05d066284688d1128a7a21 (patch)
treefbbcc33fdeeb43b1c495baba122a5be845b61ad9 /acl.go
parentssh/recv, users, schema: Create pubkey_only users (diff)
downloadforge-7fb71b36ad50153f6e05d066284688d1128a7a21.tar.gz
forge-7fb71b36ad50153f6e05d066284688d1128a7a21.tar.zst
forge-7fb71b36ad50153f6e05d066284688d1128a7a21.zip
ssh/recv, hooks: Create MRs on push, reject pushes to others' MRs
Diffstat (limited to 'acl.go')
-rw-r--r--acl.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/acl.go b/acl.go
index 7ad48fb..414e102 100644
--- a/acl.go
+++ b/acl.go
@@ -6,16 +6,18 @@ 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, user_type string, err error) {
+func get_path_perm_by_group_repo_key(ctx context.Context, group_name, repo_name, ssh_pubkey string) (repo_id int, filesystem_path string, access bool, contrib_requirements string, user_type string, user_id int, err error) {
err = database.QueryRow(ctx,
`SELECT
+ r.id,
r.filesystem_path,
CASE
WHEN ugr.user_id IS NOT NULL THEN TRUE
ELSE FALSE
END AS has_role_in_group,
r.contrib_requirements,
- COALESCE(u.type, '')
+ COALESCE(u.type, ''),
+ COALESCE(u.id, 0)
FROM
groups g
JOIN
@@ -30,6 +32,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, &user_type)
+ ).Scan(&repo_id, &filesystem_path, &access, &contrib_requirements, &user_type, &user_id)
return
}