diff options
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v6/model/group.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v6/model/group.go | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v6/model/group.go b/vendor/github.com/mattermost/mattermost-server/v6/model/group.go index 566b2361..428c431a 100644 --- a/vendor/github.com/mattermost/mattermost-server/v6/model/group.go +++ b/vendor/github.com/mattermost/mattermost-server/v6/model/group.go @@ -9,7 +9,8 @@ import ( ) const ( - GroupSourceLdap GroupSource = "ldap" + GroupSourceLdap GroupSource = "ldap" + GroupSourceCustom GroupSource = "custom" GroupNameMaxLength = 64 GroupSourceMaxLength = 64 @@ -22,6 +23,7 @@ type GroupSource string var allGroupSources = []GroupSource{ GroupSourceLdap, + GroupSourceCustom, } var groupSourcesRequiringRemoteID = []GroupSource{ @@ -34,7 +36,7 @@ type Group struct { DisplayName string `json:"display_name"` Description string `json:"description"` Source GroupSource `json:"source"` - RemoteId string `json:"remote_id"` + RemoteId *string `json:"remote_id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` @@ -43,6 +45,11 @@ type Group struct { AllowReference bool `json:"allow_reference"` } +type GroupWithUserIds struct { + Group + UserIds []string `json:"user_ids"` +} + type GroupWithSchemeAdmin struct { Group SchemeAdmin *bool `db:"SyncableSchemeAdmin" json:"scheme_admin,omitempty"` @@ -63,6 +70,8 @@ type GroupPatch struct { DisplayName *string `json:"display_name"` Description *string `json:"description"` AllowReference *bool `json:"allow_reference"` + // For security reasons (including preventing unintended LDAP group synchronization) do no allow a Group's RemoteId or Source field to be + // included in patches. } type LdapGroupSearchOpts struct { @@ -79,12 +88,21 @@ type GroupSearchOpts struct { FilterAllowReference bool PageOpts *PageOpts Since int64 + Source GroupSource // FilterParentTeamPermitted filters the groups to the intersect of the // set associated to the parent team and those returned by the query. // If the parent team is not group-constrained or if NotAssociatedToChannel // is not set then this option is ignored. FilterParentTeamPermitted bool + + // FilterHasMember filters the groups to the intersect of the + // set returned by the query and those that have the given user as a member. + FilterHasMember string +} + +type GetGroupOpts struct { + IncludeMemberCount bool } type PageOpts struct { @@ -97,6 +115,10 @@ type GroupStats struct { TotalMemberCount int64 `json:"total_member_count"` } +type GroupModifyMembers struct { + UserIds []string `json:"user_ids"` +} + func (group *Group) Patch(patch *GroupPatch) { if patch.Name != nil { group.Name = patch.Name @@ -137,7 +159,7 @@ func (group *Group) IsValidForCreate() *AppError { return NewAppError("Group.IsValidForCreate", "model.group.source.app_error", nil, "", http.StatusBadRequest) } - if len(group.RemoteId) > GroupRemoteIDMaxLength || (group.RemoteId == "" && group.requiresRemoteId()) { + if (group.GetRemoteId() == "" && group.requiresRemoteId()) || len(group.GetRemoteId()) > GroupRemoteIDMaxLength { return NewAppError("Group.IsValidForCreate", "model.group.remote_id.app_error", nil, "", http.StatusBadRequest) } @@ -188,3 +210,22 @@ func (group *Group) IsValidName() *AppError { } return nil } + +func (group *Group) GetName() string { + if group.Name == nil { + return "" + } + return *group.Name +} + +func (group *Group) GetRemoteId() string { + if group.RemoteId == nil { + return "" + } + return *group.RemoteId +} + +type GroupsWithCount struct { + Groups []*Group `json:"groups"` + TotalCount int64 `json:"total_count"` +} |