Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
7068142
wip
Jan 21, 2019
905dacb
wip
Jan 23, 2019
e7f331a
wip (delete ui code)
Jan 23, 2019
8045dfd
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 23, 2019
91c7bc5
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 23, 2019
44a06a2
feat: delete useless permissions
Jan 28, 2019
7c6869f
feat: delete useless permissions
Jan 28, 2019
adc2fef
feat: delete useless permissions
Jan 28, 2019
8efed3b
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
f2a4f41
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
3ee0671
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
1077cf7
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
4b5443f
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
b070a46
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
e62fa02
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 29, 2019
990d9f1
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 30, 2019
84c7f42
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 31, 2019
e158fad
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 31, 2019
762aeb9
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 31, 2019
e6b7438
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 31, 2019
4888a73
feat(api,ui): add permission on node and delete permissions on env, a…
Jan 31, 2019
44ff8e9
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 1, 2019
3f2cf95
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 1, 2019
f4da7bf
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 1, 2019
2f8a23a
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 1, 2019
6ac73eb
feat(cli): add group grant/revoke for a project and workflow (close #…
Feb 4, 2019
8b9673e
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 5, 2019
1a8ef0c
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 5, 2019
6f83570
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 5, 2019
e122107
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 6, 2019
3312b5f
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 6, 2019
613928f
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 6, 2019
28d59f9
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
332f1c8
merge(master)
Feb 8, 2019
c686bb9
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
ec8cb7e
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
dc74af9
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
e9c99b1
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
4a607e3
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
eb2ad01
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
21caa24
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
aed1899
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
d9b1609
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 8, 2019
a11f667
Update docs/content/gettingstarted/scopes/permissions.md
yesnault Feb 11, 2019
61142c2
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 11, 2019
328042b
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 11, 2019
b06bfe2
Merge branch 'master' of github.com:ovh/cds into delete_perm
Feb 11, 2019
bcc41e6
feat(api,ui): add permission on node and delete permissions on env, a…
Feb 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions cli/cdsctl/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func application() *cobra.Command {
cli.NewCommand(applicationCreateCmd, applicationCreateRun, nil, withAllCommandModifiers()...),
cli.NewDeleteCommand(applicationDeleteCmd, applicationDeleteRun, nil, withAllCommandModifiers()...),
applicationKey(),
applicationGroup(),
applicationVariable(),
cli.NewCommand(applicationExportCmd, applicationExportRun, nil, withAllCommandModifiers()...),
cli.NewCommand(applicationImportCmd, applicationImportRun, nil, withAllCommandModifiers()...),
Expand Down Expand Up @@ -151,12 +150,6 @@ var applicationExportCmd = cli.Command{
{Name: _ApplicationName},
},
Flags: []cli.Flag{
{
Type: cli.FlagBool,
Name: "with-permissions",
Usage: "Export permissions",
Default: "false",
},
{
Type: cli.FlagString,
Name: "format",
Expand All @@ -167,7 +160,7 @@ var applicationExportCmd = cli.Command{
}

func applicationExportRun(c cli.Values) error {
btes, err := client.ApplicationExport(c.GetString(_ProjectKey), c.GetString(_ApplicationName), c.GetBool("with-permissions"), c.GetString("format"))
btes, err := client.ApplicationExport(c.GetString(_ProjectKey), c.GetString(_ApplicationName), c.GetString("format"))
if err != nil {
return err
}
Expand Down
86 changes: 0 additions & 86 deletions cli/cdsctl/application_group.go

This file was deleted.

9 changes: 1 addition & 8 deletions cli/cdsctl/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func environment() *cobra.Command {
cli.NewDeleteCommand(environmentDeleteCmd, environmentDeleteRun, nil, withAllCommandModifiers()...),
environmentKey(),
environmentVariable(),
environmentGroup(),
cli.NewCommand(environmentExportCmd, environmentExportRun, nil, withAllCommandModifiers()...),
cli.NewCommand(environmentImportCmd, environmentImportRun, nil, withAllCommandModifiers()...),
})
Expand Down Expand Up @@ -136,12 +135,6 @@ var environmentExportCmd = cli.Command{
{Name: "environment-name"},
},
Flags: []cli.Flag{
{
Type: cli.FlagBool,
Name: "with-permissions",
Usage: "Export permissions",
Default: "false",
},
{
Type: cli.FlagString,
Name: "format",
Expand All @@ -152,7 +145,7 @@ var environmentExportCmd = cli.Command{
}

func environmentExportRun(c cli.Values) error {
btes, err := client.EnvironmentExport(c.GetString(_ProjectKey), c.GetString("environment-name"), c.GetBool("with-permissions"), c.GetString("format"))
btes, err := client.EnvironmentExport(c.GetString(_ProjectKey), c.GetString("environment-name"), c.GetString("format"))
if err != nil {
return err
}
Expand Down
85 changes: 0 additions & 85 deletions cli/cdsctl/environment_group.go

This file was deleted.

104 changes: 104 additions & 0 deletions cli/cdsctl/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"strconv"

"github.com/spf13/cobra"

Expand All @@ -21,6 +22,8 @@ func group() *cobra.Command {
cli.NewCommand(groupCreateCmd, groupCreateRun, nil),
cli.NewCommand(groupRenameCmd, groupRenameRun, nil),
cli.NewDeleteCommand(groupDeleteCmd, groupDeleteRun, nil),
cli.NewCommand(groupGrantCmd, groupGrantRun, nil),
cli.NewCommand(groupRevokeCmd, groupRevokeRun, nil),
groupUser(),
})
}
Expand Down Expand Up @@ -100,3 +103,104 @@ func groupDeleteRun(v cli.Values) error {

return err
}

var groupGrantCmd = cli.Command{
Name: "grant",
Short: "Grant a CDS group in a project or workflow",
Aliases: []string{"add", "insert"},
Ctx: []cli.Arg{
{Name: _ProjectKey},
},
Args: []cli.Arg{
{Name: "group-name"},
{
Name: "permission",
IsValid: func(arg string) bool {
perm, err := strconv.Atoi(arg)
if err != nil {
return false
}
switch perm {
case 4, 5, 7:
return true
default:
return false
}
},
},
},
Flags: []cli.Flag{
{
Name: "workflow",
ShortHand: "n",
Usage: "Workflow name",
},
{
Name: "only-project",
ShortHand: "p",
Usage: "Indicate if the group must be added only on project or also on all workflows in project",
Type: cli.FlagBool,
},
},
}

func groupGrantRun(v cli.Values) error {
groupName := v.GetString("group-name")
// Don't check error (already done in isValid function)
permission, _ := v.GetInt64("permission")
project := v.GetString(_ProjectKey)
workflow := v.GetString("workflow")

if workflow != "" {
if err := client.WorkflowGroupAdd(project, workflow, groupName, int(permission)); err != nil {
return sdk.WrapError(err, "cannot add group %s workflow %s/%s", groupName, project, workflow)
}
fmt.Printf("Group '%s' added on workflow '%s/%s' with success\n", groupName, project, workflow)
} else {
if err := client.ProjectGroupAdd(project, groupName, int(permission), v.GetBool("only-project")); err != nil {
return sdk.WrapError(err, "cannot add group %s on project %s", groupName, project)
}
fmt.Printf("Group '%s' added on project '%s' with success\n", groupName, project)
}

return nil
}

var groupRevokeCmd = cli.Command{
Name: "revoke",
Short: "Revoke a CDS group in a project or workflow",
Aliases: []string{"remove", "delete", "rm", "del"},
Ctx: []cli.Arg{
{Name: _ProjectKey},
},
Args: []cli.Arg{
{Name: "group-name"},
},
Flags: []cli.Flag{
{
Name: "workflow",
ShortHand: "n",
Usage: "Workflow name",
},
},
}

func groupRevokeRun(v cli.Values) error {
groupName := v.GetString("group-name")
project := v.GetString(_ProjectKey)
workflow := v.GetString("workflow")

if workflow != "" {
if err := client.WorkflowGroupDelete(project, workflow, groupName); err != nil {
return sdk.WrapError(err, "cannot delete group %s in workflow %s/%s", groupName, project, workflow)
}
fmt.Printf("Group '%s' deleted on workflow '%s/%s' with success\n", groupName, project, workflow)
} else {
if err := client.ProjectGroupDelete(project, groupName); err != nil {
return sdk.WrapError(err, "cannot delete group %s on project %s", groupName, project)
}
fmt.Printf("Group '%s' deleted on project '%s' with success\n", groupName, project)
}

return nil
}
14 changes: 1 addition & 13 deletions cli/cdsctl/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func pipeline() *cobra.Command {
cli.NewDeleteCommand(pipelineDeleteCmd, pipelineDeleteRun, nil, withAllCommandModifiers()...),
cli.NewCommand(pipelineExportCmd, pipelineExportRun, nil, withAllCommandModifiers()...),
cli.NewCommand(pipelineImportCmd, pipelineImportRun, nil, withAllCommandModifiers()...),
pipelineGroup(),
})
}

Expand Down Expand Up @@ -65,22 +64,11 @@ var pipelineExportCmd = cli.Command{
},
Default: "yml",
},
{
Name: "with-permission",
Usage: "true or false",
IsValid: func(s string) bool {
if s != "true" && s != "false" {
return false
}
return true
},
Type: cli.FlagBool,
},
},
}

func pipelineExportRun(v cli.Values) error {
btes, err := client.PipelineExport(v.GetString(_ProjectKey), v.GetString("pipeline-name"), v.GetBool("with-permission"), v.GetString("format"))
btes, err := client.PipelineExport(v.GetString(_ProjectKey), v.GetString("pipeline-name"), v.GetString("format"))
if err != nil {
return err
}
Expand Down
Loading