diff options
author | George Goldberg <george@gberg.me> | 2018-04-20 19:49:13 +0100 |
---|---|---|
committer | Martin Kraft <mkraft@users.noreply.github.com> | 2018-04-20 14:49:13 -0400 |
commit | cd55c44c8fd8f61cdb7cbfb57a588be82c7aa0ab (patch) | |
tree | 2979276d03b5bca72b549d7576eab104ceefd495 /model/role.go | |
parent | 853445dc2ea68f765faa04ad14618b04f1081c43 (diff) | |
download | chat-cd55c44c8fd8f61cdb7cbfb57a588be82c7aa0ab.tar.gz chat-cd55c44c8fd8f61cdb7cbfb57a588be82c7aa0ab.tar.bz2 chat-cd55c44c8fd8f61cdb7cbfb57a588be82c7aa0ab.zip |
MM-8796: Full implementation of "Schemes" in Store/Model/App layers. (#8357)
* Add Scheme model and stub store.
* Port ChannelStore to be Scheme aware.
* Make almost all the API/APP layer work with ChannelSchemes.
Only thing still hacky is UpdateChannelMemberRoles().
* Add basic SchemeStore implementation.
* Migrate UpdateChannelMemberRoles properly and fix tests.
* Update store tests and mocks so they work.
* Include creating default roles in Scheme create store function.
* Implement role deletion and start scheme deletion.
* Only use non-deleted roles for authorization.
* Add GetByScheme method to Team store.
* Add GetChannelsByScheme.
* Update store mocks.
* Implement scheme deletion in the store.
* Rename is valid function.
* Add offset and limit to queries to fetch teams and channels by scheme.
* Fix queries.
* Implement scheme awareness in Team store and add a migration.
* Tidy up ChannelStore mapping functions and add exhaustive unit tests.
* Add all missing i18n.
* Proper tests for TeamStore internal functions and fix them.
* Make additional TeamMember fields nullable.
* Make new ChannelMember fields nullable.
* Create new nullable columns without defaults.
* Make new fields in large tables nullalble.
* Fix empty list of TeamMembers.
* Deduplicate SQL queries.
* Fix spelling.
* Fix review comment.
* More review fixes.
* More review fixes.
Diffstat (limited to 'model/role.go')
-rw-r--r-- | model/role.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/model/role.go b/model/role.go index f10b52537..80ae1ae34 100644 --- a/model/role.go +++ b/model/role.go @@ -39,6 +39,7 @@ type Role struct { DeleteAt int64 `json:"delete_at"` Permissions []string `json:"permissions"` SchemeManaged bool `json:"scheme_managed"` + BuiltIn bool `json:"built_in"` } type RolePatch struct { @@ -187,6 +188,7 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_USE_SLASH_COMMANDS.Id, }, SchemeManaged: true, + BuiltIn: true, } roles[CHANNEL_ADMIN_ROLE_ID] = &Role{ @@ -197,6 +199,7 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_MANAGE_CHANNEL_ROLES.Id, }, SchemeManaged: true, + BuiltIn: true, } roles[TEAM_USER_ROLE_ID] = &Role{ @@ -210,6 +213,7 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_VIEW_TEAM.Id, }, SchemeManaged: true, + BuiltIn: true, } roles[TEAM_POST_ALL_ROLE_ID] = &Role{ @@ -219,7 +223,8 @@ func MakeDefaultRoles() map[string]*Role { Permissions: []string{ PERMISSION_CREATE_POST.Id, }, - SchemeManaged: true, + SchemeManaged: false, + BuiltIn: true, } roles[TEAM_POST_ALL_PUBLIC_ROLE_ID] = &Role{ @@ -229,7 +234,8 @@ func MakeDefaultRoles() map[string]*Role { Permissions: []string{ PERMISSION_CREATE_POST_PUBLIC.Id, }, - SchemeManaged: true, + SchemeManaged: false, + BuiltIn: true, } roles[TEAM_ADMIN_ROLE_ID] = &Role{ @@ -249,6 +255,7 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_MANAGE_WEBHOOKS.Id, }, SchemeManaged: true, + BuiltIn: true, } roles[SYSTEM_USER_ROLE_ID] = &Role{ @@ -261,6 +268,7 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_PERMANENT_DELETE_USER.Id, }, SchemeManaged: true, + BuiltIn: true, } roles[SYSTEM_POST_ALL_ROLE_ID] = &Role{ @@ -270,7 +278,8 @@ func MakeDefaultRoles() map[string]*Role { Permissions: []string{ PERMISSION_CREATE_POST.Id, }, - SchemeManaged: true, + SchemeManaged: false, + BuiltIn: true, } roles[SYSTEM_POST_ALL_PUBLIC_ROLE_ID] = &Role{ @@ -280,7 +289,8 @@ func MakeDefaultRoles() map[string]*Role { Permissions: []string{ PERMISSION_CREATE_POST_PUBLIC.Id, }, - SchemeManaged: true, + SchemeManaged: false, + BuiltIn: true, } roles[SYSTEM_USER_ACCESS_TOKEN_ROLE_ID] = &Role{ @@ -292,7 +302,8 @@ func MakeDefaultRoles() map[string]*Role { PERMISSION_READ_USER_ACCESS_TOKEN.Id, PERMISSION_REVOKE_USER_ACCESS_TOKEN.Id, }, - SchemeManaged: true, + SchemeManaged: false, + BuiltIn: true, } roles[SYSTEM_ADMIN_ROLE_ID] = &Role{ @@ -345,6 +356,7 @@ func MakeDefaultRoles() map[string]*Role { roles[CHANNEL_ADMIN_ROLE_ID].Permissions..., ), SchemeManaged: true, + BuiltIn: true, } return roles |