Skip to content

Commit

Permalink
fix update user policy ,up doc and up page
Browse files Browse the repository at this point in the history
Signed-off-by: ansjsun <[email protected]>
  • Loading branch information
ansjsun committed Jul 13, 2020
1 parent 333e739 commit ab575dc
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 91 deletions.
194 changes: 105 additions & 89 deletions console/assets_vfsdata.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/user-guide/console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Notice

* you can visit it by `http://127.0.0.1:80`
* in console default user is `root` default password is `ChubaoFSRoot`

* If you upgrade your program, the password may not be compatible, you can use `curl -H "Content-Type:application/json" -X POST --data '{"id":"testuser","pwd":"12345","type":2}' "http://10.196.59.198:17010/user/create"` to create new user to use it
16 changes: 15 additions & 1 deletion master/gapi_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,23 @@ func (m *UserService) transferUserVol(ctx context.Context, args proto.UserTransf
}

func (s *UserService) updateUserPolicy(ctx context.Context, args proto.UserPermUpdateParam) (*proto.UserInfo, error) {
if _, _, err := permissions(ctx, ADMIN); err != nil {
uid, perm, err := permissions(ctx, ADMIN|USER)
if err != nil {
return nil, err
}

if perm == USER {
if args.Volume == "" {
return nil, fmt.Errorf("user:[%s] need set userID", uid)
}
if v, e := s.cluster.getVol(args.Volume); e != nil {
return nil, e
} else {
if v.Owner != uid {
return nil, fmt.Errorf("user:[%s] is not volume:[%d] onwer", uid, args.UserID)
}
}
}
if _, err := s.cluster.getVol(args.Volume); err != nil {
return nil, err
}
Expand Down

0 comments on commit ab575dc

Please sign in to comment.