-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3778 from Kong/feat/plugins-schemas-to-new-db
This merge converts the schemas of all bundled plugins to the new DB format
- Loading branch information
Showing
77 changed files
with
1,364 additions
and
1,945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
local Errors = require "kong.dao.errors" | ||
local typedefs = require "kong.db.schema.typedefs" | ||
|
||
|
||
return { | ||
no_consumer = true, | ||
name = "acl", | ||
fields = { | ||
whitelist = { type = "array" }, | ||
blacklist = { type = "array" }, | ||
hide_groups_header = { type = "boolean", default = false }, | ||
{ consumer = typedefs.no_consumer }, | ||
{ config = { | ||
type = "record", | ||
fields = { | ||
{ whitelist = { type = "array", elements = { type = "string" }, }, }, | ||
{ blacklist = { type = "array", elements = { type = "string" }, }, }, | ||
{ hide_groups_header = { type = "boolean", default = false }, }, | ||
} | ||
} | ||
} | ||
}, | ||
entity_checks = { | ||
{ only_one_of = { "config.whitelist", "config.blacklist" }, }, | ||
{ at_least_one_of = { "config.whitelist", "config.blacklist" }, }, | ||
}, | ||
self_check = function(schema, plugin_t, dao, is_update) | ||
if next(plugin_t.whitelist or {}) and next(plugin_t.blacklist or {}) then | ||
return false, Errors.schema "You cannot set both a whitelist and a blacklist" | ||
elseif not (next(plugin_t.whitelist or {}) or next(plugin_t.blacklist or {})) then | ||
return false, Errors.schema "You must set at least a whitelist or blacklist" | ||
end | ||
return true | ||
end | ||
} |
Oops, something went wrong.