Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AllRepoUnitTypes contains all the unit types AllRepoUnitTypes = []Type{ TypeCode, TypeIssues, TypePullRequests, TypeReleases, TypeWiki, TypeExternalWiki, TypeExternalTracker, TypeProjects, TypePackages, TypeActions, } // DefaultRepoUnits contains the default unit types DefaultRepoUnits = []Type{ TypeCode, TypeIssues, TypePullRequests, TypeReleases, TypeWiki, TypeProjects, TypePackages, TypeActions, } // ForkRepoUnits contains the default unit types for forks DefaultForkRepoUnits = []Type{ TypeCode, TypePullRequests, } // NotAllowedDefaultRepoUnits contains units that can't be default NotAllowedDefaultRepoUnits = []Type{ TypeExternalWiki, TypeExternalTracker, } // DisabledRepoUnits contains the units that have been globally disabled DisabledRepoUnits = []Type{} )
View Source
var ( UnitCode = Unit{ TypeCode, "repo.code", "/", "repo.code.desc", 0, perm.AccessModeOwner, } UnitIssues = Unit{ TypeIssues, "repo.issues", "/issues", "repo.issues.desc", 1, perm.AccessModeOwner, } UnitExternalTracker = Unit{ TypeExternalTracker, "repo.ext_issues", "/issues", "repo.ext_issues.desc", 1, perm.AccessModeRead, } UnitPullRequests = Unit{ TypePullRequests, "repo.pulls", "/pulls", "repo.pulls.desc", 2, perm.AccessModeOwner, } UnitReleases = Unit{ TypeReleases, "repo.releases", "/releases", "repo.releases.desc", 3, perm.AccessModeOwner, } UnitWiki = Unit{ TypeWiki, "repo.wiki", "/wiki", "repo.wiki.desc", 4, perm.AccessModeOwner, } UnitExternalWiki = Unit{ TypeExternalWiki, "repo.ext_wiki", "/wiki", "repo.ext_wiki.desc", 4, perm.AccessModeRead, } UnitProjects = Unit{ TypeProjects, "repo.projects", "/projects", "repo.projects.desc", 5, perm.AccessModeOwner, } UnitPackages = Unit{ TypePackages, "repo.packages", "/packages", "packages.desc", 6, perm.AccessModeRead, } UnitActions = Unit{ TypeActions, "repo.actions", "/actions", "actions.unit.desc", 7, perm.AccessModeOwner, } // Units contains all the units Units = map[Type]Unit{ TypeCode: UnitCode, TypeIssues: UnitIssues, TypeExternalTracker: UnitExternalTracker, TypePullRequests: UnitPullRequests, TypeReleases: UnitReleases, TypeWiki: UnitWiki, TypeExternalWiki: UnitExternalWiki, TypeProjects: UnitProjects, TypePackages: UnitPackages, TypeActions: UnitActions, } )
Enumerate all the units
Functions ¶
func MinUnitAccessMode ¶
func MinUnitAccessMode(unitsMap map[Type]perm.AccessMode) perm.AccessMode
MinUnitAccessMode returns the minial permission of the permission map
Types ¶
type Type ¶
type Type int
Type is Unit's Type
const ( TypeInvalid Type = iota // 0 invalid TypeCode // 1 code TypeIssues // 2 issues TypePullRequests // 3 PRs TypeReleases // 4 Releases TypeWiki // 5 Wiki TypeExternalWiki // 6 ExternalWiki TypeExternalTracker // 7 ExternalTracker TypeProjects // 8 Kanban board TypePackages // 9 Packages TypeActions // 10 Actions )
Enumerate all the unit types
func FindUnitTypes ¶
FindUnitTypes give the unit key names and return valid unique units and invalid keys
func TypeFromKey ¶
TypeFromKey give the unit key name and return unit
func (*Type) CanBeDefault ¶
CanBeDefault checks if the unit type can be a default repo unit
func (Type) UnitGlobalDisabled ¶
UnitGlobalDisabled checks if unit type is global disabled
type Unit ¶
type Unit struct { Type Type NameKey string URI string DescKey string Idx int MaxAccessMode perm.AccessMode // The max access mode of the unit. i.e. Read means this unit can only be read. }
Unit is a section of one repository
func (Unit) IsLessThan ¶
IsLessThan compares order of two units
func (Unit) MaxPerm ¶
func (u Unit) MaxPerm() perm.AccessMode
MaxPerm returns the max perms of this unit
Click to show internal directories.
Click to hide internal directories.