-
Notifications
You must be signed in to change notification settings - Fork 10
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
[14.0] [IMP] cetmix_tower_server: command log access #59
[14.0] [IMP] cetmix_tower_server: command log access #59
Conversation
a7ccd68
to
11252e1
Compare
8eefe62
to
1f21d1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review LGTM
This PR has the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional LGTM
1f21d1b
to
3411c5a
Compare
3411c5a
to
e236e6e
Compare
<field name="groups" eval="[(4, ref('cetmix_tower_server.group_user'))]" /> | ||
<field | ||
name="domain_force" | ||
>[('create_uid', '=', user.id), ('command_id.access_level', '=', '1')]</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add related stored "access_level" field to the command log model to improve read performance?
<record id="cx_tower_command_log_rule_group_manager_access" model="ir.rule"> | ||
<field name="name">Tower command log: manager access rule</field> | ||
<field name="model_id" ref="model_cx_tower_command_log" /> | ||
<field name="domain_force">[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may lead to an "Access denied" exception when Manager group member will try to open Root group restricted command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test case satisfy your question?
], | ||
) | ||
# Ensure that user_bob has access to test_command_log_1 | ||
command_name_1 = test_command_log_1.with_user(self.user_bob).read(["name"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a command name. It is a command log name.
However it would be good to test if Manager can read command log of a command with "Root" access level.
For this we need to command(!) access level to "root" and than read not only name
but also command_id
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed variable name and added tests requested
e236e6e
to
e82b19e
Compare
05fdeb1
to
942b26b
Compare
942b26b
to
a6e7f14
Compare
d7fa65c
to
f386aa1
Compare
f8ea47f
to
f9ee2bc
Compare
/ocabot rebase |
@Aldeigja The rebase process failed, because command
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested with 3 servers and 3 users, and the access restrictions work.
I was not able to test ('create_uid', '=', user.id)
for a Tower User, since I couldn't run a command as a user due to a path restriction.
9045ce3
to
47e299f
Compare
265ffdb
to
470719f
Compare
Hi @norlinhenrik we've fixed this issue please test if you have opportunity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review LGTM
This PR has the |
470719f
to
536598d
Compare
Before this commit: All users who have access to the server can view its command log After this commit: User: can see only log records he created. Manager: + can see all log records for servers he has access to. Root: can see all records.
536598d
to
514bc1a
Compare
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 5f15d22. Thanks a lot for contributing to cetmix. ❤️ |
Restrict access to command log:
User: can see only log records he created.
Manager: + can see all log records for servers he has access to.
Root: can see all records.