[英]Adminer - Limit user to change only certain rows
I want to use Adminer Editor to allow users to change rows in one table.我想使用Adminer Editor来允许用户更改一个表中的行。 I use this function to limit users to see only the table I want:
我使用这个 function 来限制用户只能看到我想要的表:
function tableName($tableStatus) {
if($tableStatus['Name']==$TABLE_NAME)
return $TABLE_NAME;
}
But - I want the users to change only rows with a certain condition (for example: branch_id=10
).但是 - 我希望用户只更改具有特定条件的行(例如:
branch_id=10
)。 Who can I do this?我可以为谁做这件事?
You can use the following query To limit users to only modifying rows with a certain condition您可以使用以下查询来限制用户只能修改具有特定条件的行
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE branch_id = 10
I found an ugly way to do it:我找到了一个丑陋的方法来做到这一点:
function selectQueryBuild($select, $where, $group, $order, $limit, $page){
return "SELECT * FROM `TABLE_NAME` where BRANCH_ID=10";
}
Unless someone has a better solution, this changes all the query that will be done but it'll do the job.除非有人有更好的解决方案,否则这会改变所有将要完成的查询,但它会完成工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.