mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-29 13:43:51 +00:00
allow actions tokens to access public repos of public/limited owners
This commit is contained in:
parent
b52514ed4a
commit
a0cfa82db7
1 changed files with 17 additions and 1 deletions
|
@ -166,9 +166,25 @@ func GetActionRepoPermission(ctx context.Context, repo *repo_model.Repository, t
|
|||
return actionsTaskRepoPermission(ctx, repo, mode)
|
||||
}
|
||||
|
||||
// actions tasks may not access any other private repo
|
||||
if repo.IsPrivate {
|
||||
return Permission{AccessMode: perm_model.AccessModeNone}, nil
|
||||
}
|
||||
|
||||
// load owner for visibility check
|
||||
if err := repo.LoadOwner(ctx); err != nil {
|
||||
return Permission{}, err
|
||||
}
|
||||
|
||||
// actions tokens may not access repos belonging to private users/orgs
|
||||
if repo.Owner.Visibility.IsPrivate() {
|
||||
return Permission{AccessMode: perm_model.AccessModeNone}, nil
|
||||
}
|
||||
|
||||
// otherwise, actions tasks may read public repos belonging to public or limited owners
|
||||
return actionsTaskRepoPermission(ctx, repo, perm_model.AccessModeRead)
|
||||
}
|
||||
|
||||
// GetUserRepoPermission returns the user permissions to the repository
|
||||
func GetUserRepoPermission(ctx context.Context, repo *repo_model.Repository, user *user_model.User) (Permission, error) {
|
||||
var perm Permission
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue