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

User manager in meta #400

Merged
merged 9 commits into from
Jun 19, 2019
Merged

User manager in meta #400

merged 9 commits into from
Jun 19, 2019

Conversation

boshengchen
Copy link
Contributor

Instead of PR #257 .

  1. Addressed comments.
  2. storage the data using dataman .

@nebula-community-bot
Copy link
Member

Can one of the admins verify this patch?

@boshengchen boshengchen force-pushed the user_meta branch 2 times, most recently from 6a91327 to 208dd1a Compare May 17, 2019 08:59
src/interface/meta.thrift Outdated Show resolved Hide resolved
src/interface/meta.thrift Show resolved Hide resolved
src/meta/MetaServiceUtils.cpp Outdated Show resolved Hide resolved
@boshengchen
Copy link
Contributor Author

Thanks for your response @darionyaphet @dangleptr , I have two questions to discuss as below :
1, About user options, In fact, my original design and implementation was based on mysql ,There are options for default roles at that time. It was changed to what it is now after a couple of iterations, Thanks for your suggestions during the design phase. About option email and phone, The implementation of the syntax has been merged into the mainline,seems that we need to get a confirmed design again . and then re-implement these confirmed design. So, Please feel free to let me know if have any good ideas . Let's using issue #190 for recording.
2, About dataman , what are some good ways to avoid using dataman in module meta? Please refer to #190 for requirements. Thanks.

@boshengchen
Copy link
Contributor Author

Address some comments as below:
1, Changed user data transport protocol from dataman to thrift.
2, Removed user property email and phone.
3, Added new user property lock status, this option is referenced from mysql.

@boshengchen boshengchen force-pushed the user_meta branch 3 times, most recently from 3a52188 to dbf79e2 Compare May 30, 2019 09:24
src/interface/meta.thrift Outdated Show resolved Hide resolved
src/interface/meta.thrift Outdated Show resolved Hide resolved
src/interface/meta.thrift Show resolved Hide resolved
src/interface/meta.thrift Outdated Show resolved Hide resolved
src/interface/meta.thrift Show resolved Hide resolved
src/interface/meta.thrift Outdated Show resolved Hide resolved
@boshengchen
Copy link
Contributor Author

About SpaceID and UserID exists multiple places, I've actually thought about it,Because these two structures are used for user management often. So can use these names directly . I think convert
from name to id is superfluous in here. What do you think?
UserID and SpaceID are actually useful, they will be used for privilege management. I will use UserID and SpaceID to implement some caches in meta server or meta client.

@dangleptr
Copy link
Contributor

About SpaceID and UserID exists multiple places, I've actually thought about it,Because these two structures are used for user management often. So can use these names directly . I think convert
from name to id is superfluous in here. What do you think?
UserID and SpaceID are actually useful, they will be used for privilege management. I will use UserID and SpaceID to implement some caches in meta server or meta client.

It make sense for userId, but not for spaceID. We'd better use spaceId to join different entries instead of spaceName.

@dangleptr
Copy link
Contributor

By the way, please refer #483 . Put the user related processors under a separate dir.

@boshengchen
Copy link
Contributor Author

boshengchen commented May 31, 2019

It make sense for userId, but not for spaceID. We'd better use spaceId to join different entries instead of spaceName.
That makes sense, let me improve the space name and RoleItem related.

@boshengchen
Copy link
Contributor Author

1,Refactor user processors code structure.
2,Remove user properties first name and last name.
3, Add new user properties of resource limit.
4, Changed related thrift structure from 'name' to 'id',
5,Add some comments for role.

@boshengchen
Copy link
Contributor Author

Ready to review. Please review again. Thanks.

#ifndef GRAPH_PERMISSIONMANAGER_H
#define GRAPH_PERMISSIONMANAGER_H

// Operation and permission define:
Copy link
Contributor

Choose a reason for hiding this comment

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

Well done

@@ -162,6 +162,18 @@ Status BaseProcessor<RESP>::spaceExist(GraphSpaceID spaceId) {
return Status::SpaceNotFound();
}

template<typename RESP>
Status BaseProcessor<RESP>::userExist(UserID spaceId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we unify the userExist with getUserId ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

userExist is judged by UserID , But getUserId is judged by userName. And they query for different tables userIndex and userData. They are same with spaceExist and getSpaceId. I think it's best not to unify them. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough.

@@ -41,6 +41,16 @@ void DropSpaceProcessor::process(const cpp2::DropSpaceReq& req) {
deleteKeys.emplace_back(MetaServiceUtils::indexSpaceKey(req.get_space_name()));
deleteKeys.emplace_back(MetaServiceUtils::spaceKey(spaceId));

// delete related role data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Now we just delete the parts information when deleting space. We could delete the useless user and schema when compaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that makes sense. Let me modify it later.

}


void AlterUserProcessor::process(const cpp2::AlterUserReq& req) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the alter is to change the whole value.
I want to know what's the language for alter user?

Copy link
Contributor Author

@boshengchen boshengchen Jun 4, 2019

Choose a reason for hiding this comment

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

No, Only change properties that require alter.

Alter user sentences:

ALTER USER account WITH with_user_opt_list

with_user_opt_item
    : ACCOUNT LOCK
    | ACCOUNT UNLOCK
    | MAX_QUERIES_PER_HOUR INTEGER
    | MAX_UPDATES_PER_HOUR INTEGER
    | MAX_CONNECTIONS_PER_HOUR INTEGER
    | MAX_USER_CONNECTIONS INTEGER
    ;

with_user_opt_list
    : with_user_opt_item
    | with_user_opt_list COMMA with_user_opt_item
    ;



void ChangePasswordProcessor::process(const cpp2::ChangePasswordReq& req) {
folly::SharedMutex::WriteHolder wHolder(LockUtils::userLock());
Copy link
Contributor

Choose a reason for hiding this comment

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

Change pwd is a special sentence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Change password is a separate sentence. No need to verify the password if it is a GOD role. else the password must be validated. And GOD can change anyone's password. Other roles can only change their own password.

change_password_sentence
    : CHANGE PASSWORD account TO new_password
    | CHANGE PASSWORD account FROM old_password TO new_password
    ;

return;
}

if (!checkPassword(userRet.value(), req.get_encoded_pwd())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to know when to check the password?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a reserved interface,Used for client or terminal connections.

@dangleptr dangleptr added this to the v1_beta_release milestone Jun 4, 2019
dangleptr
dangleptr previously approved these changes Jun 12, 2019
src/meta/processors/usersMan/AuthenticationProcessor.cpp Outdated Show resolved Hide resolved
src/meta/test/CMakeLists.txt Outdated Show resolved Hide resolved
src/meta/test/TestUtils.h Show resolved Hide resolved
@boshengchen
Copy link
Contributor Author

Address laura-ding's comment

boshengchen added 7 commits June 17, 2019 09:29
…moved user property email and phone. 3, Added new user property lock status
…irst name and last name. 3, Add new user properties of resource limit. 4, Changed related thrift structure from 'name' to 'id', 5,Add some comments for role.
@dangleptr
Copy link
Contributor

Jenkins go

@nebula-community-bot
Copy link
Member

Unit testing passed.

@@ -171,3 +171,33 @@ nebula_link_libraries(
gtest
)
nebula_add_test(meta_http_test)
add_executable(
Copy link
Contributor

Choose a reason for hiding this comment

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

image
There are no aligned with 4 Spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A stupid mistake,corrected.

Copy link
Contributor

@laura-ding laura-ding left a comment

Choose a reason for hiding this comment

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

Well done

@boshengchen
Copy link
Contributor Author

Jenkins go

@dangleptr
Copy link
Contributor

Jenkins go

@nebula-community-bot
Copy link
Member

Unit testing passed.

Copy link
Contributor

@dangleptr dangleptr left a comment

Choose a reason for hiding this comment

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

Well done

@dangleptr dangleptr merged commit 13a849e into vesoft-inc:master Jun 19, 2019
@boshengchen boshengchen deleted the user_meta branch June 19, 2019 09:40
yixinglu pushed a commit to yixinglu/nebula that referenced this pull request Feb 16, 2020
* User manager of Meta Server

* 1, Changed user data transport protocol from dataman to thrift. 2, Removed user property email and phone. 3, Added new user property lock status

* 1,Refactor user processors code structure. 2,Remove user properties first name and last name. 3, Add new user properties of resource limit. 4, Changed related thrift structure from 'name' to 'id', 5,Add some comments for role.

* To improve the drop space , on't delete useless role data

* Rebased and added (raftex_obj raftex_thrift_obj wal_obj time_obj) to authentication_test module

* Rebased and resolved some conflicts

* Address laura-ding's comment

* Resolved code alignment
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
* User manager of Meta Server

* 1, Changed user data transport protocol from dataman to thrift. 2, Removed user property email and phone. 3, Added new user property lock status

* 1,Refactor user processors code structure. 2,Remove user properties first name and last name. 3, Add new user properties of resource limit. 4, Changed related thrift structure from 'name' to 'id', 5,Add some comments for role.

* To improve the drop space , on't delete useless role data

* Rebased and added (raftex_obj raftex_thrift_obj wal_obj time_obj) to authentication_test module

* Rebased and resolved some conflicts

* Address laura-ding's comment

* Resolved code alignment
yixinglu pushed a commit to yixinglu/nebula that referenced this pull request Mar 21, 2022
#### What type of PR is this?
- [ ] bug
- [ ] feature
- [x] enhancement

#### What does this PR do?
The original br tools require password-free ssh to each machine which add extra work for users.
This pr's main goal is to remove ssh dependency. To do this, we introduce an agent in each machine.
Then br can handle machines' data through agent's service.
Agent communicate with the meta service through heartbeat. By heartbeat, agent register itself
to meta service and pull the services it should supervise in its host.

The agent: vesoft-inc/nebula-agent#1
The br: vesoft-inc/nebula-br#22

This pr includes:
1. refactor br related code, including renaming and adjust code structure.
2. batch the snapshot rpc by spaces
3. add agent heartbeat
4. report data/root path in the storaged/graphd heartbeat

#### Which issue(s)/PR(s) this PR relates to?

The agent: vesoft-inc/nebula-agent#1
The br: vesoft-inc/nebula-br#22
  
#### Special notes for your reviewer, ex. impact of this fix, etc:


#### Additional context:


#### Checklist:
- [ ] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatible (If it is incompatible, please describe it and add corresponding label.)
- [ ] Need to cherry-pick (If need to cherry-pick to some branches, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory


#### Release notes:
Please confirm whether to reflect in release notes and how to describe:
>                                                                 `


Migrated from vesoft-inc#3469

Co-authored-by: pengwei.song <90180021+pengweisong@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants