Skip to content

Commit

Permalink
change ExportConfig action
Browse files Browse the repository at this point in the history
remove sizes from varchar in parade
  • Loading branch information
guy-har committed Nov 10, 2020
1 parent 913a26c commit 04c9489
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ func (c *Controller) ExportSetContinuousExportHandler() exportop.SetContinuousEx
return exportop.SetContinuousExportHandlerFunc(func(params exportop.SetContinuousExportParams, user *models.User) middleware.Responder {
deps, err := c.setupRequest(user, params.HTTPRequest, []permissions.Permission{
{
Action: permissions.ExportSetConfigAction,
Action: permissions.ExportConfigAction,
Resource: permissions.BranchArn(params.Repository, params.Branch),
},
})
Expand Down
2 changes: 1 addition & 1 deletion auth/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func SetupBaseGroups(authService Service, ts time.Time) error {
Statement: model.Statements{
{
Action: []string{
"export:Set*",
"fs:ExportConfig",
},
Resource: permissions.All,
Effect: model.StatementEffectAllow,
Expand Down
19 changes: 11 additions & 8 deletions ddl/000011_parade.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CREATE TYPE task_status_code_value AS ENUM (
CREATE TABLE IF NOT EXISTS tasks (
id VARCHAR NOT NULL PRIMARY KEY, -- nanoid

action VARCHAR(128) NOT NULL, -- name (type) of action to perform
action VARCHAR NOT NULL, -- name (type) of action to perform
body TEXT, -- data used by action
status TEXT, -- status text defined by action, visible to action

Expand All @@ -25,15 +25,15 @@ CREATE TABLE IF NOT EXISTS tasks (
total_dependencies INTEGER, -- number of tasks that must signal this task
num_signals INTEGER NOT NULL DEFAULT 0, -- number of tasks that have already signalled this task

actor_id VARCHAR(64), -- ID of performing actor if in-progress
actor_id VARCHAR, -- ID of performing actor if in-progress
action_deadline TIMESTAMPTZ, -- offer this task to other actors once action_deadline has elapsed
performance_token UUID,

-- BUG(ariels): add REFERENCES dependency to each of the to_signal_after
-- tasks. Or at least add triggers that perform ON DELETE
-- CASCADE.
to_signal_after VARCHAR(64) ARRAY, -- IDs to signal after performing this task
notify_channel_after VARCHAR(64) -- (if non-NULL) name of a channel to NOTIFY when this task ends
to_signal_after VARCHAR ARRAY, -- IDs to signal after performing this task
notify_channel_after VARCHAR -- (if non-NULL) name of a channel to NOTIFY when this task ends
);

-- Returns true if task with this id, code and deadline can
Expand All @@ -49,9 +49,9 @@ $$;
-- belonging to `actor_id' and returns their ids and a "performance
-- token". Both must be returned to complete the task successfully.
CREATE OR REPLACE FUNCTION own_tasks(
max_tasks INTEGER, actions VARCHAR(128) ARRAY, owner_id VARCHAR(64), max_duration INTERVAL
max_tasks INTEGER, actions VARCHAR ARRAY, owner_id VARCHAR, max_duration INTERVAL
)
RETURNS TABLE(task_id VARCHAR, token UUID, num_failures INTEGER, action VARCHAR(128), body TEXT)
RETURNS TABLE(task_id VARCHAR, token UUID, num_failures INTEGER, action VARCHAR, body TEXT)
LANGUAGE sql VOLATILE AS $$
UPDATE tasks
SET actor_id = owner_id,
Expand Down Expand Up @@ -99,8 +99,11 @@ CREATE OR REPLACE FUNCTION return_task(
LANGUAGE plpgsql AS $$
DECLARE
num_updated INTEGER;
channel VARCHAR(64);
to_signal VARCHAR(64) ARRAY;
channel VARCHAR;
to_signal VARCHAR ARRAY;



BEGIN
CASE result_status_code
WHEN 'aborted', 'completed' THEN
Expand Down
2 changes: 1 addition & 1 deletion export/tasks_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func NewTasksGenerator(exportID string, dstPrefix string, generateSuccessFor fun
// Add translates diffs into many tasks and remembers "generate success" tasks for Finish. It
// returns some tasks that can already be added.
func (e *TasksGenerator) Add(diffs catalog.Differences) ([]parade.TaskData, error) {
const initialSize = 1000
const initialSize = 1_000

zero := 0

Expand Down
3 changes: 1 addition & 2 deletions permissions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ const (
ReadBranchAction = "fs:ReadBranch"
RevertBranchAction = "fs:RevertBranch"
ListBranchesAction = "fs:ListBranches"
ExportConfigAction = "fs:ExportConfig"

RetentionReadPolicyAction = "retention:GetPolicy"
RetentionWritePolicyAction = "retention:WritePolicy"

ExportSetConfigAction = "fs:export:SetConfig"

ReadUserAction = "auth:ReadUser"
CreateUserAction = "auth:CreateUser"
DeleteUserAction = "auth:DeleteUser"
Expand Down

0 comments on commit 04c9489

Please sign in to comment.