MCPcopy Create free account
hub / github.com/cloudbase/garm / hasAdmin

Method hasAdmin

database/sql/users.go:95–99  ·  view source on GitHub ↗
(tx *gorm.DB)

Source from the content-addressed store, hash-verified

93}
94
95func (s *sqlDatabase) hasAdmin(tx *gorm.DB) bool {
96 var user User
97 q := tx.Model(&User{}).Where("is_admin = ?", true).First(&user)
98 return q.Error == nil
99}
100
101func (s *sqlDatabase) HasAdminUser(_ context.Context) bool {
102 return s.hasAdmin(s.conn)

Callers 2

CreateUserMethod · 0.95
HasAdminUserMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected