MCPcopy Create free account
hub / github.com/dolthub/doltgresql / SetRole

Function SetRole

server/auth/database.go:101–111  ·  view source on GitHub ↗

SetRole sets the role matching the given name. This will add a role that does not yet exist, and overwrite an existing role.

(role Role)

Source from the content-addressed store, hash-verified

99// SetRole sets the role matching the given name. This will add a role that does not yet exist, and overwrite an
100// existing role.
101func SetRole(role Role) {
102 // We want to ignore invalid roles, which should not exist outside specific circumstances (like during login)
103 if role.id == 0 {
104 return
105 }
106 if existingRole, ok := globalDatabase.rolesByID[role.id]; ok {
107 delete(globalDatabase.rolesByName, existingRole.Name)
108 }
109 globalDatabase.rolesByName[role.Name] = role.id
110 globalDatabase.rolesByID[role.ID()] = role
111}
112
113// IsSuperUser returns whether the given role is a SUPERUSER.
114func IsSuperUser(role RoleID) bool {

Callers 3

RowIterMethod · 0.92
RowIterMethod · 0.92
dbInitDefaultFunction · 0.70

Calls 1

IDMethod · 0.45

Tested by

no test coverage detected