app: add permissions wrapper (#20242)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0dd1969bd5
Коммит
9985e22dab
@@ -219,6 +219,10 @@ func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, err
|
||||
app: &App{ch: ch},
|
||||
}
|
||||
|
||||
services[PermissionsKey] = &permissionsServiceWrapper{
|
||||
app: &App{ch: ch},
|
||||
}
|
||||
|
||||
return ch, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,14 @@ import (
|
||||
const permissionsExportBatchSize = 100
|
||||
const systemSchemeName = "00000000-0000-0000-0000-000000000000" // Prevents collisions with user-created schemes.
|
||||
|
||||
type permissionsServiceWrapper struct {
|
||||
app AppIface
|
||||
}
|
||||
|
||||
func (s *permissionsServiceWrapper) HasPermissionToTeam(userID string, teamID string, permission *model.Permission) bool {
|
||||
return s.app.HasPermissionToTeam(userID, teamID, permission)
|
||||
}
|
||||
|
||||
func (a *App) ResetPermissionsSystem() *model.AppError {
|
||||
// Reset all Teams to not have a scheme.
|
||||
if err := a.Srv().Store.Team().ResetAllTeamSchemes(); err != nil {
|
||||
|
||||
@@ -86,13 +86,14 @@ var SentryDSN = "placeholder_sentry_dsn"
|
||||
type ServiceKey string
|
||||
|
||||
const (
|
||||
ChannelKey ServiceKey = "channel"
|
||||
ConfigKey ServiceKey = "config"
|
||||
LicenseKey ServiceKey = "license"
|
||||
FilestoreKey ServiceKey = "filestore"
|
||||
ClusterKey ServiceKey = "cluster"
|
||||
PostKey ServiceKey = "post"
|
||||
TeamKey ServiceKey = "team"
|
||||
ChannelKey ServiceKey = "channel"
|
||||
ConfigKey ServiceKey = "config"
|
||||
LicenseKey ServiceKey = "license"
|
||||
FilestoreKey ServiceKey = "filestore"
|
||||
ClusterKey ServiceKey = "cluster"
|
||||
PostKey ServiceKey = "post"
|
||||
TeamKey ServiceKey = "team"
|
||||
PermissionsKey ServiceKey = "permissions"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
||||
Ссылка в новой задаче
Block a user