-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
NEW - See the documents of my subordinates #28318
Conversation
This will generate a lot of trouble in permission systems and data view will not be consistent between screen, but this is not a pb as long as it remains a hidden option.
|
for me it's no longer this case "order that has a sale representative that is among subordinates" What do you mean by |
100% of the code is base in this rule:
If your definition is "order that has a sale representative that is among subordinates", the modification must not be done by changing the sql at each place by by forcing the search_salerepresentative to the list of id of sale representative that are subordinates. So the code that you have removed
should not be removed, but replaced with
So we force the filter at begin of code in the head/security section. then in sql instead of doing a filter on search_sale, it must be a filter on IN ($db->sanitize($search_sale)) |
I understand. for me it doesn't make sense to mix research with security. $search_sale lives up to its name and is made for search. If I display the orders of my subordinates, how can I filter them to one of them or myself. Since the field is preselected with my name. The goal is to have this behavior on all views and the user will not be lost since he knows that he is the supervisor. It is normal for a supervisor to see the work of his subordinates. I agree that this should be an option to keep the initial behavior by default. There is also a security problem because if you clear the filters it displays the complete list without restriction. It is necessary that
Or lower. |
@eldy I rewrote the code to be simpler and optimized on the principles of holidays like in your example. |
htdocs/commande/list.php
Outdated
@@ -879,6 +883,16 @@ | |||
if ($socid > 0) { | |||
$sql .= ' AND s.rowid = '.((int) $socid); | |||
} | |||
|
|||
// Restriction on sale representative | |||
if (!$permissiontoreadallthirdparty && !$socid) { |
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.
Why
if (!$permissiontoreadallthirdparty && !$socid) {
and not
if (!$permissiontoreadallthirdparty) {
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.
Also the condition on MAIN_SEE_SUBORDINATES must appears.
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.
Ok it's done
@@ -223,15 +227,16 @@ | |||
//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); | |||
$arrayfields = dol_sort_array($arrayfields, 'position'); | |||
|
|||
if (!$user->hasRight('societe', 'client', 'voir')) { | |||
$search_sale = $user->id; |
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.
It seems we loose this protection when we are in default mode:
If MAIN_SEE_SUBORDINATES not set and user has no permission to read all, this was used to restrict list on $search_sale at line 1011 (in old code file)
So you should restore a restriction into the select. For example in your addition line 888
if (!$permissiontoreadallthirdparty && getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
you can do
if (!$permissiontoreadallthirdparty) {
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
// restrict on list in userschilds
} else {
// default mode, restrict on user->id only.
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.
yes I see I did
NEW|New [*See the documents of my subordinates *]
[This function is essential in my opinion]
proposal following comment from PR #24035
@eldy if good for you i change for propal invoice and thirdparty in other PR