Description
Feature Description
When I was reviewing the changes in my PR #22705,
I found something strange: why UnitPackagesGlobalDisabled
here?
https://github.com/go-gitea/gitea/pull/22705/files#diff-8020089c79cc846f287e738cf57917d21ec16499df1d994e6c31309d06a1a5afL28
Then I searched UnitPackagesGlobalDisabled
, it is not existed.
So what about UnitProjectsGlobalDisabled
?
I found it in here.
gitea/modules/context/context.go
Line 783 in 7d3c4c3
The next question is why we didn't define UnitPackagesGlobalDisabled
here. If it is not defined, how do we controll this unit's visibility in repo's header?
Then I checked the codes in repo's header:
gitea/templates/repo/header.tmpl
Lines 156 to 229 in b811ab4
Almost of them use
.Permission.CanRead
to check the visibility, but some of them also use UnitXXXXXXGlobalDisabled
. The definition is:gitea/modules/context/context.go
Line 783 in b811ab4
And at someplaces, I found we also use settings.UnitName.Enabled
e.g.
Line 159 in 3596df5
It seems that
UnitXXXXXXGlobalDisabled
and the permission model is used for repo units,and we have no permission model for user/org level packages/projects, so
settings
are used directly here.
Then the next question is what is the difference between them?
Im not familiar with go, and I don't understand how the permission model works now.
Maybe I asked a stupid question, but I want to make sure my PR's codes are correct.
Then I changed the app.ini, to disable Packages
, it worked. It seems that .Permission.CanRead
is correct.
Then I found DEFAULT_REPO_UNITS
and DISABLED_REPO_UNITS
in the document. It seems that we can control the repo unit by this setting option. I think maybe UnitXXXXXXGlobalDisabled
is related to it?
Then I disabled Package
and Projects
, restart the server, but it didn't work, I can still access them.
Then I searched DISABLED_REPO_UNITS
, and no record in any go files.
So I created this issue #23001
I made a mistake in setting the vaule of DISABLED_REPO_UNITS
, but no warning or error info. Maybe we can add it. -> #23024
Screenshots
No response