Additional APIs for Focalboard multi-product architecture (#20608)
- adds HasPermissionToChannel to permissions service - adds GetChannelsForTeamForUser to channel service
Этот коммит содержится в:
@@ -40,6 +40,10 @@ func (s *channelsWrapper) GetChannelMember(channelID string, userID string) (*mo
|
||||
return s.srv.getChannelMember(context.Background(), channelID, userID)
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) {
|
||||
return s.srv.getChannelsForTeamForUser(teamID, userID, opts)
|
||||
}
|
||||
|
||||
// DefaultChannelNames returns the list of system-wide default channel names.
|
||||
//
|
||||
// By default the list will be (not necessarily in this order):
|
||||
@@ -1818,8 +1822,8 @@ func (a *App) GetChannelByNameForTeamName(channelName, teamName string, includeD
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (a *App) GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) {
|
||||
list, err := a.Srv().Store.Channel().GetChannels(teamID, userID, opts)
|
||||
func (s *Server) getChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) {
|
||||
list, err := s.Store.Channel().GetChannels(teamID, userID, opts)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
@@ -1833,6 +1837,10 @@ func (a *App) GetChannelsForTeamForUser(teamID string, userID string, opts *mode
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (a *App) GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError) {
|
||||
return a.Srv().getChannelsForTeamForUser(teamID, userID, opts)
|
||||
}
|
||||
|
||||
func (a *App) GetChannelsForTeamForUserWithCursor(teamID string, userID string, opts *model.ChannelSearchOpts, afterChannelID string) (model.ChannelList, *model.AppError) {
|
||||
list, err := a.Srv().Store.Channel().GetChannelsWithCursor(teamID, userID, opts, afterChannelID)
|
||||
if err != nil {
|
||||
|
||||
@@ -27,6 +27,10 @@ func (s *permissionsServiceWrapper) HasPermissionToTeam(userID string, teamID st
|
||||
return s.app.HasPermissionToTeam(userID, teamID, permission)
|
||||
}
|
||||
|
||||
func (s *permissionsServiceWrapper) HasPermissionToChannel(askingUserID string, channelID string, permission *model.Permission) bool {
|
||||
return s.app.HasPermissionToChannel(askingUserID, channelID, permission)
|
||||
}
|
||||
|
||||
func (a *App) ResetPermissionsSystem() *model.AppError {
|
||||
// Reset all Teams to not have a scheme.
|
||||
if err := a.Srv().Store.Team().ResetAllTeamSchemes(); err != nil {
|
||||
|
||||
@@ -41,6 +41,7 @@ type PostService interface {
|
||||
// The service shall be registered via app.PermissionKey service key.
|
||||
type PermissionService interface {
|
||||
HasPermissionToTeam(userID, teamID string, permission *model.Permission) bool
|
||||
HasPermissionToChannel(askingUserID string, channelID string, permission *model.Permission) bool
|
||||
}
|
||||
|
||||
// ClusterService enables to publish cluster events. In addition to that, It's being used for
|
||||
@@ -61,6 +62,7 @@ type ChannelService interface {
|
||||
GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError)
|
||||
GetChannelByID(channelID string) (*model.Channel, *model.AppError)
|
||||
GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError)
|
||||
GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError)
|
||||
}
|
||||
|
||||
// LicenseService provides license related utilities.
|
||||
|
||||
Ссылка в новой задаче
Block a user