diff options
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go | 102 |
1 files changed, 66 insertions, 36 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go b/vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go index c861c1e6..b2bc713c 100644 --- a/vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go +++ b/vendor/github.com/mattermost/mattermost-server/v6/model/scheme.go @@ -14,23 +14,29 @@ const ( SchemeDescriptionMaxLength = 1024 SchemeScopeTeam = "team" SchemeScopeChannel = "channel" + SchemeScopePlaybook = "playbook" + SchemeScopeRun = "run" ) type Scheme struct { - Id string `json:"id"` - Name string `json:"name"` - DisplayName string `json:"display_name"` - Description string `json:"description"` - CreateAt int64 `json:"create_at"` - UpdateAt int64 `json:"update_at"` - DeleteAt int64 `json:"delete_at"` - Scope string `json:"scope"` - DefaultTeamAdminRole string `json:"default_team_admin_role"` - DefaultTeamUserRole string `json:"default_team_user_role"` - DefaultChannelAdminRole string `json:"default_channel_admin_role"` - DefaultChannelUserRole string `json:"default_channel_user_role"` - DefaultTeamGuestRole string `json:"default_team_guest_role"` - DefaultChannelGuestRole string `json:"default_channel_guest_role"` + Id string `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + CreateAt int64 `json:"create_at"` + UpdateAt int64 `json:"update_at"` + DeleteAt int64 `json:"delete_at"` + Scope string `json:"scope"` + DefaultTeamAdminRole string `json:"default_team_admin_role"` + DefaultTeamUserRole string `json:"default_team_user_role"` + DefaultChannelAdminRole string `json:"default_channel_admin_role"` + DefaultChannelUserRole string `json:"default_channel_user_role"` + DefaultTeamGuestRole string `json:"default_team_guest_role"` + DefaultChannelGuestRole string `json:"default_channel_guest_role"` + DefaultPlaybookAdminRole string `json:"default_playbook_admin_role"` + DefaultPlaybookMemberRole string `json:"default_playbook_member_role"` + DefaultRunAdminRole string `json:"default_run_admin_role"` + DefaultRunMemberRole string `json:"default_run_member_role"` } type SchemePatch struct { @@ -45,31 +51,39 @@ type SchemeIDPatch struct { // SchemeConveyor is used for importing and exporting a Scheme and its associated Roles. type SchemeConveyor struct { - Name string `json:"name"` - DisplayName string `json:"display_name"` - Description string `json:"description"` - Scope string `json:"scope"` - TeamAdmin string `json:"default_team_admin_role"` - TeamUser string `json:"default_team_user_role"` - TeamGuest string `json:"default_team_guest_role"` - ChannelAdmin string `json:"default_channel_admin_role"` - ChannelUser string `json:"default_channel_user_role"` - ChannelGuest string `json:"default_channel_guest_role"` - Roles []*Role `json:"roles"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + Description string `json:"description"` + Scope string `json:"scope"` + TeamAdmin string `json:"default_team_admin_role"` + TeamUser string `json:"default_team_user_role"` + TeamGuest string `json:"default_team_guest_role"` + ChannelAdmin string `json:"default_channel_admin_role"` + ChannelUser string `json:"default_channel_user_role"` + ChannelGuest string `json:"default_channel_guest_role"` + PlaybookAdmin string `json:"default_playbook_admin_role"` + PlaybookMember string `json:"default_playbook_member_role"` + RunAdmin string `json:"default_run_admin_role"` + RunMember string `json:"default_run_member_role"` + Roles []*Role `json:"roles"` } func (sc *SchemeConveyor) Scheme() *Scheme { return &Scheme{ - DisplayName: sc.DisplayName, - Name: sc.Name, - Description: sc.Description, - Scope: sc.Scope, - DefaultTeamAdminRole: sc.TeamAdmin, - DefaultTeamUserRole: sc.TeamUser, - DefaultTeamGuestRole: sc.TeamGuest, - DefaultChannelAdminRole: sc.ChannelAdmin, - DefaultChannelUserRole: sc.ChannelUser, - DefaultChannelGuestRole: sc.ChannelGuest, + DisplayName: sc.DisplayName, + Name: sc.Name, + Description: sc.Description, + Scope: sc.Scope, + DefaultTeamAdminRole: sc.TeamAdmin, + DefaultTeamUserRole: sc.TeamUser, + DefaultTeamGuestRole: sc.TeamGuest, + DefaultChannelAdminRole: sc.ChannelAdmin, + DefaultChannelUserRole: sc.ChannelUser, + DefaultChannelGuestRole: sc.ChannelGuest, + DefaultPlaybookAdminRole: sc.PlaybookAdmin, + DefaultPlaybookMemberRole: sc.PlaybookMember, + DefaultRunAdminRole: sc.RunAdmin, + DefaultRunMemberRole: sc.RunMember, } } @@ -101,7 +115,7 @@ func (scheme *Scheme) IsValidForCreate() bool { } switch scheme.Scope { - case SchemeScopeTeam, SchemeScopeChannel: + case SchemeScopeTeam, SchemeScopeChannel, SchemeScopePlaybook, SchemeScopeRun: default: return false } @@ -130,6 +144,22 @@ func (scheme *Scheme) IsValidForCreate() bool { if !IsValidRoleName(scheme.DefaultTeamGuestRole) { return false } + + if !IsValidRoleName(scheme.DefaultPlaybookAdminRole) { + return false + } + + if !IsValidRoleName(scheme.DefaultPlaybookMemberRole) { + return false + } + + if !IsValidRoleName(scheme.DefaultRunAdminRole) { + return false + } + + if !IsValidRoleName(scheme.DefaultRunMemberRole) { + return false + } } if scheme.Scope == SchemeScopeChannel { |