MM-63200: unrestricted local admin (#30295)

* use SessionHasPermissionToCheckRestrictedAdmin

* allow unrestricted config edits from localmode

* check model.PermissionManageSystem for getLatestVersion

* simplify/clarify RequestTrialLicense semantics

* rename for clarity

* whitespace from linter

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Jesse Hallam
2025-04-10 16:22:03 -03:00
коммит произвёл GitHub
родитель ca9fd45408
Коммит 42274b9eee
11 изменённых файлов: 142 добавлений и 117 удалений

Просмотреть файл

@@ -1354,6 +1354,9 @@ func (api *PluginAPI) PublishPluginClusterEvent(ev model.PluginClusterEvent,
// RequestTrialLicense requests a trial license and installs it in the server
func (api *PluginAPI) RequestTrialLicense(requesterID string, users int, termsAccepted bool, receiveEmailsAccepted bool) *model.AppError {
// Normally, plugins are unrestricted in their abilities, but to maintain backwards compatbilibity with plugins
// that were unaware of the nuances of ExperimentalSettings.RestrictSystemAdmin, we restrict the trial license
// unconditionally.
if *api.app.Config().ExperimentalSettings.RestrictSystemAdmin {
return model.NewAppError("RequestTrialLicense", "api.restricted_system_admin", nil, "", http.StatusForbidden)
}