Skip to content

Commit df424ee

Browse files
committed
Merge branch 'main' into fix_22301
2 parents 6a9e90c + bcc4c62 commit df424ee

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

services/lfs/server.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"strconv"
1818
"strings"
1919

20+
actions_model "code.gitea.io/gitea/models/actions"
2021
git_model "code.gitea.io/gitea/models/git"
2122
"code.gitea.io/gitea/models/perm"
2223
access_model "code.gitea.io/gitea/models/perm/access"
@@ -495,10 +496,27 @@ func authenticate(ctx *context.Context, repository *repo_model.Repository, autho
495496
accessMode = perm.AccessModeWrite
496497
}
497498

499+
if ctx.Data["IsActionsToken"] == true {
500+
taskID := ctx.Data["ActionsTaskID"].(int64)
501+
task, err := actions_model.GetTaskByID(ctx, taskID)
502+
if err != nil {
503+
log.Error("Unable to GetTaskByID for task[%d] Error: %v", taskID, err)
504+
return false
505+
}
506+
if task.RepoID != repository.ID {
507+
return false
508+
}
509+
510+
if task.IsForkPullRequest {
511+
return accessMode <= perm.AccessModeRead
512+
}
513+
return accessMode <= perm.AccessModeWrite
514+
}
515+
498516
// ctx.IsSigned is unnecessary here, this will be checked in perm.CanAccess
499517
perm, err := access_model.GetUserRepoPermission(ctx, repository, ctx.Doer)
500518
if err != nil {
501-
log.Error("Unable to GetUserRepoPermission for user %-v in repo %-v Error: %v", ctx.Doer, repository)
519+
log.Error("Unable to GetUserRepoPermission for user %-v in repo %-v Error: %v", ctx.Doer, repository, err)
502520
return false
503521
}
504522

templates/admin/auth/source/oauth.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@
7474

7575
<div class="field">
7676
<label for="oauth2_scopes">{{.locale.Tr "admin.auths.oauth2_scopes"}}</label>
77-
<input id="oauth2_scopes" name="oauth2_scopes" values="{{.oauth2_scopes}}">
77+
<input id="oauth2_scopes" name="oauth2_scopes" value="{{.oauth2_scopes}}">
7878
</div>
7979
<div class="field">
8080
<label for="oauth2_required_claim_name">{{.locale.Tr "admin.auths.oauth2_required_claim_name"}}</label>
81-
<input id="oauth2_required_claim_name" name="oauth2_required_claim_name" values="{{.oauth2_required_claim_name}}">
81+
<input id="oauth2_required_claim_name" name="oauth2_required_claim_name" value="{{.oauth2_required_claim_name}}">
8282
<p class="help">{{.locale.Tr "admin.auths.oauth2_required_claim_name_helper"}}</p>
8383
</div>
8484
<div class="field">
8585
<label for="oauth2_required_claim_value">{{.locale.Tr "admin.auths.oauth2_required_claim_value"}}</label>
86-
<input id="oauth2_required_claim_value" name="oauth2_required_claim_value" values="{{.oauth2_required_claim_value}}">
86+
<input id="oauth2_required_claim_value" name="oauth2_required_claim_value" value="{{.oauth2_required_claim_value}}">
8787
<p class="help">{{.locale.Tr "admin.auths.oauth2_required_claim_value_helper"}}</p>
8888
</div>
8989
<div class="field">
@@ -92,18 +92,18 @@
9292
</div>
9393
<div class="field">
9494
<label for="oauth2_admin_group">{{.locale.Tr "admin.auths.oauth2_admin_group"}}</label>
95-
<input id="oauth2_admin_group" name="oauth2_admin_group" value="{{.oauth2_group_claim_name}}">
95+
<input id="oauth2_admin_group" name="oauth2_admin_group" value="{{.oauth2_admin_group}}">
9696
</div>
9797
<div class="field">
9898
<label for="oauth2_restricted_group">{{.locale.Tr "admin.auths.oauth2_restricted_group"}}</label>
99-
<input id="oauth2_restricted_group" name="oauth2_restricted_group" value="{{.oauth2_group_claim_name}}">
99+
<input id="oauth2_restricted_group" name="oauth2_restricted_group" value="{{.oauth2_restricted_group}}">
100100
</div>
101101
<div class="field">
102102
<label>{{.locale.Tr "admin.auths.oauth2_map_group_to_team"}}</label>
103-
<input name="oauth2_group_team_map" value="{{.group_team_map}}" placeholder='e.g. {"Developer": {"MyGiteaOrganization": ["MyGiteaTeam1", "MyGiteaTeam2"]}}'>
103+
<input name="oauth2_group_team_map" value="{{.oauth2_group_team_map}}" placeholder='e.g. {"Developer": {"MyGiteaOrganization": ["MyGiteaTeam1", "MyGiteaTeam2"]}}'>
104104
</div>
105105
<div class="ui checkbox">
106106
<label>{{.locale.Tr "admin.auths.oauth2_map_group_to_team_removal"}}</label>
107-
<input name="oauth2_group_team_map_removal" type="checkbox" {{if .group_team_map_removal}}checked{{end}}>
107+
<input name="oauth2_group_team_map_removal" type="checkbox" {{if .oauth2_group_team_map_removal}}checked{{end}}>
108108
</div>
109109
</div>

0 commit comments

Comments
 (0)