Skip to content

Commit fc80a8a

Browse files
committed
Copy Permissions struct actions_model
Referencing it could cause inconsistencies if it changes later.
1 parent 724e138 commit fc80a8a

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

models/migrations/v1_21/v276.go

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,39 @@
44
package v1_21 //nolint
55

66
import (
7-
actions_model "code.gitea.io/gitea/models/actions"
8-
97
"xorm.io/xorm"
108
)
119

10+
// Permission copied from models.actions.Permission
11+
type Permission int
12+
13+
const (
14+
PermissionUnspecified Permission = iota
15+
PermissionNone
16+
PermissionRead
17+
PermissionWrite
18+
)
19+
20+
// Permissions copied from models.actions.Permissions
21+
type Permissions struct {
22+
Actions Permission `yaml:"actions"`
23+
Checks Permission `yaml:"checks"`
24+
Contents Permission `yaml:"contents"`
25+
Deployments Permission `yaml:"deployments"`
26+
IDToken Permission `yaml:"id-token"`
27+
Issues Permission `yaml:"issues"`
28+
Discussions Permission `yaml:"discussions"`
29+
Packages Permission `yaml:"packages"`
30+
Pages Permission `yaml:"pages"`
31+
PullRequests Permission `yaml:"pull-requests"`
32+
RepositoryProjects Permission `yaml:"repository-projects"`
33+
SecurityEvents Permission `yaml:"security-events"`
34+
Statuses Permission `yaml:"statuses"`
35+
}
36+
1237
func AddPermissions(x *xorm.Engine) error {
1338
type ActionRunJob struct {
14-
Permissions actions_model.Permissions `xorm:"JSON TEXT"`
39+
Permissions Permissions `xorm:"JSON TEXT"`
1540
}
1641

1742
return x.Sync(new(ActionRunJob))

0 commit comments

Comments
 (0)