diff options
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/role.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v5/model/role.go | 243 |
1 files changed, 209 insertions, 34 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/role.go b/vendor/github.com/mattermost/mattermost-server/v5/model/role.go index 271e295b..fc1606ce 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/role.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/role.go @@ -47,6 +47,12 @@ func init() { // When updating the values here, the values in mattermost-redux must also be updated. SysconsoleAncillaryPermissions = map[string][]*Permission{ + PERMISSION_SYSCONSOLE_READ_ABOUT_EDITION_AND_LICENSE.Id: { + PERMISSION_READ_LICENSE_INFORMATION, + }, + PERMISSION_SYSCONSOLE_WRITE_ABOUT_EDITION_AND_LICENSE.Id: { + PERMISSION_MANAGE_LICENSE_INFORMATION, + }, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_CHANNELS.Id: { PERMISSION_READ_PUBLIC_CHANNEL, PERMISSION_READ_CHANNEL, @@ -55,19 +61,44 @@ func init() { }, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_USERS.Id: { PERMISSION_READ_OTHER_USERS_TEAMS, + PERMISSION_GET_ANALYTICS, }, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_TEAMS.Id: { PERMISSION_LIST_PRIVATE_TEAMS, PERMISSION_LIST_PUBLIC_TEAMS, PERMISSION_VIEW_TEAM, }, - PERMISSION_SYSCONSOLE_READ_ENVIRONMENT.Id: { - PERMISSION_READ_JOBS, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_ELASTICSEARCH.Id: { + PERMISSION_READ_ELASTICSEARCH_POST_INDEXING_JOB, + PERMISSION_READ_ELASTICSEARCH_POST_AGGREGATION_JOB, + }, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_WEB_SERVER.Id: { + PERMISSION_TEST_SITE_URL, + PERMISSION_RELOAD_CONFIG, + PERMISSION_INVALIDATE_CACHES, + }, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_DATABASE.Id: { + PERMISSION_RECYCLE_DATABASE_CONNECTIONS, + }, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_ELASTICSEARCH.Id: { + PERMISSION_TEST_ELASTICSEARCH, + PERMISSION_CREATE_ELASTICSEARCH_POST_INDEXING_JOB, + PERMISSION_CREATE_ELASTICSEARCH_POST_AGGREGATION_JOB, + PERMISSION_PURGE_ELASTICSEARCH_INDEXES, }, - PERMISSION_SYSCONSOLE_READ_AUTHENTICATION.Id: { - PERMISSION_READ_JOBS, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_FILE_STORAGE.Id: { + PERMISSION_TEST_S3, }, - PERMISSION_SYSCONSOLE_READ_REPORTING.Id: { + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_SMTP.Id: { + PERMISSION_TEST_EMAIL, + }, + PERMISSION_SYSCONSOLE_READ_REPORTING_SERVER_LOGS.Id: { + PERMISSION_GET_LOGS, + }, + PERMISSION_SYSCONSOLE_READ_REPORTING_SITE_STATISTICS.Id: { + PERMISSION_GET_ANALYTICS, + }, + PERMISSION_SYSCONSOLE_READ_REPORTING_TEAM_STATISTICS.Id: { PERMISSION_VIEW_TEAM, }, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_USERS.Id: { @@ -102,12 +133,54 @@ func init() { PERMISSION_CONVERT_PUBLIC_CHANNEL_TO_PRIVATE, PERMISSION_CONVERT_PRIVATE_CHANNEL_TO_PUBLIC, }, - PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT.Id: { - PERMISSION_MANAGE_JOBS, - }, - PERMISSION_SYSCONSOLE_WRITE_SITE.Id: { + PERMISSION_SYSCONSOLE_WRITE_SITE_CUSTOMIZATION.Id: { PERMISSION_EDIT_BRAND, }, + PERMISSION_SYSCONSOLE_WRITE_COMPLIANCE_DATA_RETENTION_POLICY.Id: { + PERMISSION_CREATE_DATA_RETENTION_JOB, + }, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_DATA_RETENTION_POLICY.Id: { + PERMISSION_READ_DATA_RETENTION_JOB, + }, + PERMISSION_SYSCONSOLE_WRITE_COMPLIANCE_COMPLIANCE_EXPORT.Id: { + PERMISSION_CREATE_COMPLIANCE_EXPORT_JOB, + PERMISSION_DOWNLOAD_COMPLIANCE_EXPORT_RESULT, + }, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_COMPLIANCE_EXPORT.Id: { + PERMISSION_READ_COMPLIANCE_EXPORT_JOB, + PERMISSION_DOWNLOAD_COMPLIANCE_EXPORT_RESULT, + }, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_CUSTOM_TERMS_OF_SERVICE.Id: { + PERMISSION_READ_AUDITS, + }, + PERMISSION_SYSCONSOLE_WRITE_EXPERIMENTAL_BLEVE.Id: { + PERMISSION_CREATE_POST_BLEVE_INDEXES_JOB, + PERMISSION_PURGE_BLEVE_INDEXES, + }, + PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION_LDAP.Id: { + PERMISSION_CREATE_LDAP_SYNC_JOB, + PERMISSION_ADD_LDAP_PUBLIC_CERT, + PERMISSION_REMOVE_LDAP_PUBLIC_CERT, + PERMISSION_ADD_LDAP_PRIVATE_CERT, + PERMISSION_REMOVE_LDAP_PRIVATE_CERT, + }, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_LDAP.Id: { + PERMISSION_TEST_LDAP, + PERMISSION_READ_LDAP_SYNC_JOB, + }, + PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION_EMAIL.Id: { + PERMISSION_INVALIDATE_EMAIL_INVITE, + }, + PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION_SAML.Id: { + PERMISSION_GET_SAML_METADATA_FROM_IDP, + PERMISSION_ADD_SAML_PUBLIC_CERT, + PERMISSION_ADD_SAML_PRIVATE_CERT, + PERMISSION_ADD_SAML_IDP_CERT, + PERMISSION_REMOVE_SAML_PUBLIC_CERT, + PERMISSION_REMOVE_SAML_PRIVATE_CERT, + PERMISSION_REMOVE_SAML_IDP_CERT, + PERMISSION_GET_SAML_CERT_STATUS, + }, } SystemUserManagerDefaultPermissions = []string{ @@ -118,29 +191,76 @@ func init() { PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_GROUPS.Id, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_TEAMS.Id, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_CHANNELS.Id, - PERMISSION_SYSCONSOLE_READ_AUTHENTICATION.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SIGNUP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_EMAIL.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_PASSWORD.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_MFA.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_LDAP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SAML.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_OPENID.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_GUEST_ACCESS.Id, } SystemReadOnlyAdminDefaultPermissions = []string{ - PERMISSION_SYSCONSOLE_READ_ABOUT.Id, - PERMISSION_SYSCONSOLE_READ_REPORTING.Id, + PERMISSION_SYSCONSOLE_READ_ABOUT_EDITION_AND_LICENSE.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_SITE_STATISTICS.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_TEAM_STATISTICS.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_SERVER_LOGS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_USERS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_GROUPS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_TEAMS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_CHANNELS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_PERMISSIONS.Id, - PERMISSION_SYSCONSOLE_READ_ENVIRONMENT.Id, - PERMISSION_SYSCONSOLE_READ_SITE.Id, - PERMISSION_SYSCONSOLE_READ_AUTHENTICATION.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_WEB_SERVER.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_DATABASE.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_ELASTICSEARCH.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_FILE_STORAGE.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_IMAGE_PROXY.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_SMTP.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_PUSH_NOTIFICATION_SERVER.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_HIGH_AVAILABILITY.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_LOGGING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_SESSION_LENGTHS.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_PERFORMANCE_MONITORING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER.Id, + PERMISSION_SYSCONSOLE_READ_SITE_CUSTOMIZATION.Id, + PERMISSION_SYSCONSOLE_READ_SITE_LOCALIZATION.Id, + PERMISSION_SYSCONSOLE_READ_SITE_USERS_AND_TEAMS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_NOTIFICATIONS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_ANNOUNCEMENT_BANNER.Id, + PERMISSION_SYSCONSOLE_READ_SITE_EMOJI.Id, + PERMISSION_SYSCONSOLE_READ_SITE_POSTS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_FILE_SHARING_AND_DOWNLOADS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_PUBLIC_LINKS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_NOTICES.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SIGNUP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_EMAIL.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_PASSWORD.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_MFA.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_LDAP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SAML.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_OPENID.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_GUEST_ACCESS.Id, PERMISSION_SYSCONSOLE_READ_PLUGINS.Id, - PERMISSION_SYSCONSOLE_READ_COMPLIANCE.Id, - PERMISSION_SYSCONSOLE_READ_INTEGRATIONS.Id, - PERMISSION_SYSCONSOLE_READ_EXPERIMENTAL.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_INTEGRATION_MANAGEMENT.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_BOT_ACCOUNTS.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_GIF.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_CORS.Id, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_DATA_RETENTION_POLICY.Id, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_COMPLIANCE_EXPORT.Id, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_COMPLIANCE_MONITORING.Id, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE_CUSTOM_TERMS_OF_SERVICE.Id, + PERMISSION_SYSCONSOLE_READ_EXPERIMENTAL_FEATURES.Id, + PERMISSION_SYSCONSOLE_READ_EXPERIMENTAL_FEATURE_FLAGS.Id, + PERMISSION_SYSCONSOLE_READ_EXPERIMENTAL_BLEVE.Id, } SystemManagerDefaultPermissions = []string{ - PERMISSION_SYSCONSOLE_READ_ABOUT.Id, - PERMISSION_SYSCONSOLE_READ_REPORTING.Id, + PERMISSION_SYSCONSOLE_READ_ABOUT_EDITION_AND_LICENSE.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_SITE_STATISTICS.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_TEAM_STATISTICS.Id, + PERMISSION_SYSCONSOLE_READ_REPORTING_SERVER_LOGS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_GROUPS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_TEAMS.Id, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_CHANNELS.Id, @@ -149,20 +269,75 @@ func init() { PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_TEAMS.Id, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_CHANNELS.Id, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_PERMISSIONS.Id, - PERMISSION_SYSCONSOLE_READ_ENVIRONMENT.Id, - PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT.Id, - PERMISSION_SYSCONSOLE_READ_SITE.Id, - PERMISSION_SYSCONSOLE_WRITE_SITE.Id, - PERMISSION_SYSCONSOLE_READ_AUTHENTICATION.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_WEB_SERVER.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_DATABASE.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_ELASTICSEARCH.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_FILE_STORAGE.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_IMAGE_PROXY.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_SMTP.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_PUSH_NOTIFICATION_SERVER.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_HIGH_AVAILABILITY.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_LOGGING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_SESSION_LENGTHS.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_PERFORMANCE_MONITORING.Id, + PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_WEB_SERVER.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_DATABASE.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_ELASTICSEARCH.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_FILE_STORAGE.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_IMAGE_PROXY.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_SMTP.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_PUSH_NOTIFICATION_SERVER.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_HIGH_AVAILABILITY.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_RATE_LIMITING.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_LOGGING.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_SESSION_LENGTHS.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_PERFORMANCE_MONITORING.Id, + PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT_DEVELOPER.Id, + PERMISSION_SYSCONSOLE_READ_SITE_CUSTOMIZATION.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_CUSTOMIZATION.Id, + PERMISSION_SYSCONSOLE_READ_SITE_LOCALIZATION.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_LOCALIZATION.Id, + PERMISSION_SYSCONSOLE_READ_SITE_USERS_AND_TEAMS.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_USERS_AND_TEAMS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_NOTIFICATIONS.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_NOTIFICATIONS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_ANNOUNCEMENT_BANNER.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_ANNOUNCEMENT_BANNER.Id, + PERMISSION_SYSCONSOLE_READ_SITE_EMOJI.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_EMOJI.Id, + PERMISSION_SYSCONSOLE_READ_SITE_POSTS.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_POSTS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_FILE_SHARING_AND_DOWNLOADS.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_FILE_SHARING_AND_DOWNLOADS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_PUBLIC_LINKS.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_PUBLIC_LINKS.Id, + PERMISSION_SYSCONSOLE_READ_SITE_NOTICES.Id, + PERMISSION_SYSCONSOLE_WRITE_SITE_NOTICES.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SIGNUP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_EMAIL.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_PASSWORD.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_MFA.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_LDAP.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_SAML.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_OPENID.Id, + PERMISSION_SYSCONSOLE_READ_AUTHENTICATION_GUEST_ACCESS.Id, PERMISSION_SYSCONSOLE_READ_PLUGINS.Id, - PERMISSION_SYSCONSOLE_READ_INTEGRATIONS.Id, - PERMISSION_SYSCONSOLE_WRITE_INTEGRATIONS.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_INTEGRATION_MANAGEMENT.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_BOT_ACCOUNTS.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_GIF.Id, + PERMISSION_SYSCONSOLE_READ_INTEGRATIONS_CORS.Id, + PERMISSION_SYSCONSOLE_WRITE_INTEGRATIONS_INTEGRATION_MANAGEMENT.Id, + PERMISSION_SYSCONSOLE_WRITE_INTEGRATIONS_BOT_ACCOUNTS.Id, + PERMISSION_SYSCONSOLE_WRITE_INTEGRATIONS_GIF.Id, + PERMISSION_SYSCONSOLE_WRITE_INTEGRATIONS_CORS.Id, } // Add the ancillary permissions to each system role - SystemUserManagerDefaultPermissions = addAncillaryPermissions(SystemUserManagerDefaultPermissions) - SystemReadOnlyAdminDefaultPermissions = addAncillaryPermissions(SystemReadOnlyAdminDefaultPermissions) - SystemManagerDefaultPermissions = addAncillaryPermissions(SystemManagerDefaultPermissions) + SystemUserManagerDefaultPermissions = AddAncillaryPermissions(SystemUserManagerDefaultPermissions) + SystemReadOnlyAdminDefaultPermissions = AddAncillaryPermissions(SystemReadOnlyAdminDefaultPermissions) + SystemManagerDefaultPermissions = AddAncillaryPermissions(SystemManagerDefaultPermissions) } type RoleType string @@ -278,7 +453,7 @@ func (r *Role) MergeChannelHigherScopedPermissions(higherScopedPermissions *Role _, presentOnHigherScope := higherScopedPermissionsMap[cp.Id] - // For the channel admin role always look to the higher scope to determine if the role has ther permission. + // For the channel admin role always look to the higher scope to determine if the role has their permission. // The channel admin is a special case because they're not part of the UI to be "channel moderated", only // channel members and channel guests are. if higherScopedPermissions.RoleID == CHANNEL_ADMIN_ROLE_ID && presentOnHigherScope { @@ -475,7 +650,7 @@ func (r *Role) IsValidWithoutId() bool { return false } - if len(r.DisplayName) == 0 || len(r.DisplayName) > ROLE_DISPLAY_NAME_MAX_LENGTH { + if r.DisplayName == "" || len(r.DisplayName) > ROLE_DISPLAY_NAME_MAX_LENGTH { return false } @@ -519,7 +694,7 @@ func CleanRoleNames(roleNames []string) ([]string, bool) { } func IsValidRoleName(roleName string) bool { - if len(roleName) <= 0 || len(roleName) > ROLE_NAME_MAX_LENGTH { + if roleName == "" || len(roleName) > ROLE_NAME_MAX_LENGTH { return false } @@ -765,7 +940,7 @@ func MakeDefaultRoles() map[string]*Role { return roles } -func addAncillaryPermissions(permissions []string) []string { +func AddAncillaryPermissions(permissions []string) []string { for _, permission := range permissions { if ancillaryPermissions, ok := SysconsoleAncillaryPermissions[permission]; ok { for _, ancillaryPermission := range ancillaryPermissions { |