Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin users #2554

Merged
merged 1 commit into from
Oct 16, 2018
Merged

Add admin users #2554

merged 1 commit into from
Oct 16, 2018

Conversation

harshavardhana
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Sep 27, 2018

Codecov Report

Merging #2554 into master will decrease coverage by 0.26%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2554      +/-   ##
==========================================
- Coverage   10.49%   10.22%   -0.27%     
==========================================
  Files         107      117      +10     
  Lines       10828    11114     +286     
==========================================
  Hits         1136     1136              
- Misses       9542     9828     +286     
  Partials      150      150
Impacted Files Coverage Δ
cmd/admin-main.go 0% <ø> (ø) ⬆️
cmd/admin-users-disable.go 0% <0%> (ø)
cmd/find.go 43.28% <0%> (ø) ⬆️
cmd/admin-policies-remove.go 0% <0%> (ø)
cmd/admin-policies-add.go 0% <0%> (ø)
cmd/admin-users-remove.go 0% <0%> (ø)
cmd/admin-users.go 0% <0%> (ø)
cmd/admin-policies.go 0% <0%> (ø)
cmd/admin-policies-list.go 0% <0%> (ø)
cmd/admin-credentials.go 0% <0%> (ø) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bbc81f...fe368dd. Read the comment docs.

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

e := client.AddUser(args.Get(1), args.Get(2))
fatalIf(probe.NewError(e).Trace(args...), "Cannot add new user")

policy, e := ioutil.ReadFile(args.Get(3))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's load policy first to fail before adding a user above.


// checkAdminUsersRemoveSyntax - validate all the passed arguments
func checkAdminUsersRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 4 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think two arguments not four


// checkAdminUsersRevokeSyntax - validate all the passed arguments
func checkAdminUsersRevokeSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 4 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two arguments

"github.com/minio/minio/pkg/madmin"
)

var adminUsersRevokeCmd = cli.Command{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, if we revoke the user, how can we reenable it again ?

}
}

// mainAdminUsersRevoke is the handle for "mc admin users add" command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"mc admin users add" -> "mc admin users revoke"

cmd/admin-users.go Outdated Show resolved Hide resolved
}
}

// mainAdminUsersRemove is the handle for "mc admin users add" command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mc admin users add" -> mc admin users remove"

@harshavardhana
Copy link
Member Author

This PR is changing a bit

@@ -273,19 +275,69 @@ FLAGS:
Storage : Used 8.2GiB
```

<a name="users"></a>
### Command `users` - Manage regular users
`users` command to add new, remove, enable, disable, list users on Minio server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new, -> add

{{.HelpName}} - {{.Usage}}

USAGE:
{{.HelpName}} TARGET USERNAME PASSWORD POLICYTYPE|POLICYFILE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add possible values of policy type ? and a short example of policy file content

@vadmeste
Copy link
Member

One little problem is when trying to upload an object, mc cp, in a bucket.. it doesn't work because for some reasons, mc want to list all buckets, readwrite policy won't guarantee it that, but users can use custom policy document probably and then fix this later

@harshavardhana
Copy link
Member Author

One little problem is when trying to upload an object, mc cp, in a bucket.. it doesn't work because for some reasons, mc want to list all buckets, readwrite policy won't guarantee it that, but users can use custom policy document probably and then fix this later

This is something of a problem in minio-go I think it constructs policies with explicit API names but not for everything.

@harshavardhana
Copy link
Member Author

After talking to @abperiasamy some more requirements came in blocking this for now.

@poornas
Copy link
Contributor

poornas commented Oct 16, 2018

Removing a revoked user gives an inconsistent error that specified key does not exist.

➜  mc git:(a52ea918) ✗ mc admin users add myss3 newus2e4r newuser123 readonly --insecure
Added used `newus2e4r` successfully.
➜  mc git:(a52ea918) ✗ mc admin users disable myss3 newus2e4r --insecure    
Disabled user `newus2e4r` successfully.
➜  mc git:(a52ea918) ✗ mc admin users remove myss3 newus2e4r --insecure     
mc: <ERROR> Cannot remove new user The specified key does not exist.

server side
Error: Object not found: .minio.sys#config/iam/users/newus2e4r/policy.json
       1: cmd/logger/logger.go:295:logger.LogIf()
       2: cmd/admin-handlers.go:733:cmd.adminAPIHandlers.RemoveUser()
       3: cmd/admin-router.go:96:cmd.(adminAPIHandlers).RemoveUser-fm()
       4: net/http/server.go:1947:http.HandlerFunc.ServeHTTP()

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM & tested

Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested & LGTM

@deekoder deekoder merged commit b7e87b6 into minio:master Oct 16, 2018
@harshavardhana harshavardhana deleted the users branch October 16, 2018 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants