mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Make OIDC admin groups configurable (#1555)
This removes the current default of checking for membership of the admin or admins group and makes it required to explicitly configure which groups should grant admin access, if any. Relying on the implicit default of admin or admins is potentially dangerous as that group may contain a different subset of people that we may wish to grant admin access to GtS. This is probably not an issue for a single-person instance, but for a community instance different admin groups may exist in an OIDC provider for different applications. I'm explicitly opting for not defaulting the value of oidc-admin-groups to admin,admins because I think it's better for those things to be explicitly configured.
This commit is contained in:
@@ -1724,6 +1724,31 @@ func GetOIDCLinkExisting() bool { return global.GetOIDCLinkExisting() }
|
||||
// SetOIDCLinkExisting safely sets the value for global configuration 'OIDCLinkExisting' field
|
||||
func SetOIDCLinkExisting(v bool) { global.SetOIDCLinkExisting(v) }
|
||||
|
||||
// GetOIDCAdminGroups safely fetches the Configuration value for state's 'OIDCAdminGroups' field
|
||||
func (st *ConfigState) GetOIDCAdminGroups() (v []string) {
|
||||
st.mutex.Lock()
|
||||
v = st.config.OIDCAdminGroups
|
||||
st.mutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetOIDCAdminGroups safely sets the Configuration value for state's 'OIDCAdminGroups' field
|
||||
func (st *ConfigState) SetOIDCAdminGroups(v []string) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.OIDCAdminGroups = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// OIDCAdminGroupsFlag returns the flag name for the 'OIDCAdminGroups' field
|
||||
func OIDCAdminGroupsFlag() string { return "oidc-admin-groups" }
|
||||
|
||||
// GetOIDCAdminGroups safely fetches the value for global configuration 'OIDCAdminGroups' field
|
||||
func GetOIDCAdminGroups() []string { return global.GetOIDCAdminGroups() }
|
||||
|
||||
// SetOIDCAdminGroups safely sets the value for global configuration 'OIDCAdminGroups' field
|
||||
func SetOIDCAdminGroups(v []string) { global.SetOIDCAdminGroups(v) }
|
||||
|
||||
// GetSMTPHost safely fetches the Configuration value for state's 'SMTPHost' field
|
||||
func (st *ConfigState) GetSMTPHost() (v string) {
|
||||
st.mutex.Lock()
|
||||
|
Reference in New Issue
Block a user