MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / HasDisallowedQueryPatterns

Method HasDisallowedQueryPatterns

types/account.go:181–208  ·  view source on GitHub ↗

HasDisallowedQueryPatterns returns whether the queries are permitted.

(queries []Query)

Source from the content-addressed store, hash-verified

179
180// HasDisallowedQueryPatterns returns whether the queries are permitted.
181func (up *UserPermission) HasDisallowedQueryPatterns(queries []Query) (query string, status bool) {
182 if up == nil {
183 status = true
184 return
185 }
186 if len(up.Patterns) == 0 {
187 status = false
188 return
189 }
190
191 up.cachedPatternMapOnce.Do(func() {
192 up.cachedPatternMap = make(map[string]bool, len(up.Patterns))
193 for _, p := range up.Patterns {
194 up.cachedPatternMap[p] = true
195 }
196 })
197
198 for _, q := range queries {
199 if !up.cachedPatternMap[q.Pattern] {
200 // not permitted
201 query = q.Pattern
202 status = true
203 break
204 }
205 }
206
207 return
208}
209
210// Status defines status of a SQLChain user/miner.
211type Status int32

Callers 2

TestUserPermissionFunction · 0.80
checkPermissionMethod · 0.80

Calls 1

DoMethod · 0.80

Tested by 1

TestUserPermissionFunction · 0.64