-
-
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 funclionality to Clone user with permissions and categories #29773
Conversation
htdocs/user/class/user.class.php
Outdated
$sql .= " SELECT 1"; | ||
$sql .= " FROM ".$this->db->prefix()."user_rights dest"; | ||
$sql .= " WHERE dest.entity = src.entity"; | ||
$sql .= " AND dest.fk_user = ".$this->db->escape($toId); |
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 is an int so must use
$sql .= " AND dest.fk_user = ".((int) $toId);
htdocs/user/class/user.class.php
Outdated
|
||
// Construction de la requête d'insertion | ||
$sql = "INSERT INTO ".$this->db->prefix()."user_rights (entity, fk_user, fk_id)"; | ||
$sql .= " SELECT entity, ".$this->db->escape($toId).", fk_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 is an int so must use
$sql .= " SELECT entity, ".((int) $toId).", fk_id";
htdocs/user/class/user.class.php
Outdated
$categorystatic = new Categorie($this->db); | ||
|
||
$sql = "INSERT INTO ".$this->db->prefix()."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type])." (fk_categorie, fk_user)"; | ||
$sql .= " SELECT fk_categorie, $toId FROM ".$this->db->prefix()."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type]); |
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.
$toId must be sanitized with (int)
@lamrani002 it will probably be necessary to adapt the cloning functions when Multicompany uses user centralization on the main entity! |
An easy to do first step can be to show the clone feature only if user is in same entity than current entity. So cloning is kept always in same entity. |
NEW|New functionality to clone user