summaryrefslogtreecommitdiffstats
path: root/models/unit/unit.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-08 23:51:50 +0800
committerGitHub <noreply@github.com>2022-05-08 17:51:50 +0200
commitd4834071da9ce010fd4677ef339c598dd23dc130 (patch)
treeee6692b9b44e259d79158c2dc2b867d8f3286630 /models/unit/unit.go
parent6a969681cd862bf153fa7921485278be1e8a092a (diff)
downloadgitea-d4834071da9ce010fd4677ef339c598dd23dc130.tar.gz
gitea-d4834071da9ce010fd4677ef339c598dd23dc130.zip
Repository level enable package or disable (#19323)
Diffstat (limited to 'models/unit/unit.go')
-rw-r--r--models/unit/unit.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/models/unit/unit.go b/models/unit/unit.go
index a6a47eb1f3..9d3cae5f25 100644
--- a/models/unit/unit.go
+++ b/models/unit/unit.go
@@ -27,6 +27,7 @@ const (
TypeExternalWiki // 6 ExternalWiki
TypeExternalTracker // 7 ExternalTracker
TypeProjects // 8 Kanban board
+ TypePackages // 9 Packages
)
// Value returns integer value for unit type
@@ -52,6 +53,8 @@ func (u Type) String() string {
return "TypeExternalTracker"
case TypeProjects:
return "TypeProjects"
+ case TypePackages:
+ return "TypePackages"
}
return fmt.Sprintf("Unknown Type %d", u)
}
@@ -74,6 +77,7 @@ var (
TypeExternalWiki,
TypeExternalTracker,
TypeProjects,
+ TypePackages,
}
// DefaultRepoUnits contains the default unit types
@@ -84,6 +88,7 @@ var (
TypeReleases,
TypeWiki,
TypeProjects,
+ TypePackages,
}
// NotAllowedDefaultRepoUnits contains units that can't be default
@@ -275,6 +280,15 @@ var (
perm.AccessModeOwner,
}
+ UnitPackages = Unit{
+ TypePackages,
+ "repo.packages",
+ "/packages",
+ "repo.packages.desc",
+ 6,
+ perm.AccessModeRead,
+ }
+
// Units contains all the units
Units = map[Type]Unit{
TypeCode: UnitCode,
@@ -285,6 +299,7 @@ var (
TypeWiki: UnitWiki,
TypeExternalWiki: UnitExternalWiki,
TypeProjects: UnitProjects,
+ TypePackages: UnitPackages,
}
)