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

Ability to disable SQL editor toolbar buttons #19130

Open
goldmont opened this issue Apr 26, 2024 · 6 comments · May be fixed by #19147
Open

Ability to disable SQL editor toolbar buttons #19130

goldmont opened this issue Apr 26, 2024 · 6 comments · May be fixed by #19147
Labels
enhancement A feature request for improving phpMyAdmin

Comments

@goldmont
Copy link

Hi,

Is it possible to disable SELECT, INSERT, UPDATE and DELETE buttons from the SQL editor toolbar? Thanks.

Screenshot from 2024-04-26 18-03-10

Server configuration

  • Operating system: Ubuntu 22.04
  • Web server: Apache/2.4.57
  • PHP version: 8.2.8
  • phpMyAdmin version: 5.2.1 (Docker image)
@MoonE
Copy link
Contributor

MoonE commented Apr 26, 2024

Why?

@goldmont
Copy link
Author

Why?

Hi,

I'm an high school teacher. I would like to prevent my students from having an almost-ready query just by clicking on a button.

@MoonE
Copy link
Contributor

MoonE commented Apr 26, 2024

You can append this css:

#select.sqlbutton,
#selectall.sqlbutton,
#insert.sqlbutton,
#update.sqlbutton,
#delete.sqlbutton {
  display:none;
}

to each of the theme files:

themes/metro/css/theme.css
themes/metro/css/theme.rtl.css
themes/original/css/theme.css
themes/original/css/theme.rtl.css
themes/pmahomme/css/theme.css
themes/pmahomme/css/theme.rtl.css
themes/bootstrap/css/theme.css
themes/bootstrap/css/theme.rtl.css

which will prevent the buttons from being displayed by default.

Though a savvy student would be able to enable them again with the browser developer tools.

@goldmont
Copy link
Author

Thank you for the tip.

In fact I hoped there was a PHP-side solution like not outputting the buttons at all.

@MoonE
Copy link
Contributor

MoonE commented Apr 26, 2024

You could delete these lines:

{% if columns_list is not empty %}
<div class="btn-group me-2" role="group">
<input type="button" value="SELECT *" id="selectall" class="btn btn-secondary button sqlbutton">
<input type="button" value="SELECT" id="select" class="btn btn-secondary button sqlbutton">
<input type="button" value="INSERT" id="insert" class="btn btn-secondary button sqlbutton">
<input type="button" value="UPDATE" id="update" class="btn btn-secondary button sqlbutton">
<input type="button" value="DELETE" id="delete" class="btn btn-secondary button sqlbutton">
</div>
{% endif %}

@williamdes williamdes added the enhancement A feature request for improving phpMyAdmin label Apr 26, 2024
@goldmont
Copy link
Author

@MoonE Thank you for helping me. Do you think it will be possible to enable/disable via config in the future? Maybe a boolean value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature request for improving phpMyAdmin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants