473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Privileges on specific fields in a DB

How do I make a table with fields again, say, name, age, address, wife
etc. that I want people to be able to look at (with any client like
MysqlCC etc), but only be able to modify certain fields, eg. wife (this
includes deleting the field from the database, maybe) - the name, age
etc. must be left intact, ie. not changeable by anyone.
Thanks.

Oct 31 '05 #1
8 2510
>How do I make a table with fields again, say, name, age, address, wife
etc. that I want people to be able to look at (with any client like
MysqlCC etc), but only be able to modify certain fields, eg. wife (this
includes deleting the field from the database, maybe) - the name, age
etc. must be left intact, ie. not changeable by anyone.


You think 'age' is a field that is never going to change? It would be
best to store 'birth date', which really won't change.

You can't have a database not changeable by *anyone*. Even a CD-ROM
can be thrown into a fire, and hard disks can be re-formatted. The
admin of a system is going to have broad powers to replace MySQL
with a version that doesn't honor permissions.

Using MySQL permissions, you can create a login with privileges to
only modify certain fields. Look in the MySQL manual under
'GRANT and REVOKE syntax'.

If you are thinking of a web page, perhaps the application is better
written with the web page code (PHP?) written so it will not attempt
to change any fields but the ones you want changeable.

Gordon L. Burditt
Oct 31 '05 #2
The solution is something like this:

grant select (name, age, address, wife), update (wife), delete (wife),
insert (wife) on database.table to 'user'@'host';

Markus
Oct 31 '05 #3
>grant select (name, age, address, wife), update (wife), delete (wife),
insert (wife) on database.table to 'user'@'host';

Markus


What does it *MEAN* to have delete privileges on a column? You
delete a whole row, which affects all columns in that row. The
column-based privileges are select, update, insert, and references.

Gordon L. Burditt
Nov 1 '05 #4
"Gordon Burditt" <go****@hammy.burditt.org> wrote in message
news:11*************@corp.supernews.com...
grant select (name, age, address, wife), update (wife), delete (wife),
insert (wife) on database.table to 'user'@'host';

Markus


What does it *MEAN* to have delete privileges on a column? You
delete a whole row, which affects all columns in that row. The
column-based privileges are select, update, insert, and references.

Gordon L. Burditt


Sounds like he wants to give someone the ability to change a specific
record. For example, to allow me to select and examine my personal record,
add a wife if I get married, or delete a wife if I get divorced. If this is
correct, then having update privledges on the wife field would allow someone
to do that.

Is this correct, Markus?

Phil
Nov 1 '05 #5
>> >grant select (name, age, address, wife), update (wife), delete (wife),
>insert (wife) on database.table to 'user'@'host';
>
>Markus
What does it *MEAN* to have delete privileges on a column? You
delete a whole row, which affects all columns in that row. The
column-based privileges are select, update, insert, and references.

Gordon L. Burditt


Sounds like he wants to give someone the ability to change a specific
record.


MySQL grant privileges alone do not offer that ability. You
can do it with views and grant privileges on the view, not the
underlying table. You might also do it with triggers.
For example, to allow me to select and examine my personal record,
add a wife if I get married, or delete a wife if I get divorced. If this is
correct, then having update privledges on the wife field would allow someone
to do that.


That's not what the 'delete' privilege means. You don't delete a
column in a specific row; you set it to null. You'd need update,
not delete, privilege to change the field from one value to another.
'update' privilege on a column means that you can change the value
of that column in *EVERY* row. 'delete' (on a table-wide basis)
means the ability to delete rows.

Selective column privileges are more suited to the ability to
restrict a low-level HR employee to view ALL salaries but not change
ANY of them, and to not allow viewing or changing of passwords at
all.

Gordon L. Burditt
Nov 1 '05 #6
> The column-based privileges are select, update, insert, and references.

The 'references' privilege ist currently unused - it does exist as well as
some other privileges, too. To allow a user to delete records, the delete
privilege is required.

Markus
Nov 2 '05 #7
>> The column-based privileges are select, update, insert, and references.

The 'references' privilege ist currently unused - it does exist as well as
some other privileges, too.
There is no *column-based* delete privilege. 'delete' privilege
applies to particular tables.
To allow a user to delete records, the delete
privilege is required.


It is not meaningful to delete a particular column out of a particular
row. You can only delete entire rows.

Gordon L. Burditt
Nov 2 '05 #8
Okey, you won ;-) - I was still a level too high.

Markus
Nov 2 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dominic Marks | last post by:
Hi, (I apologise if this is the wrong list, I haven't posted to a postgresql.org mailing list before, general seemed like a good catch-all) I am trying to implement a centralised...
5
by: sunilkeswani | last post by:
Hi, I have a combo with a list of names. On the basis of a particular name selected, I want a few hidden fields to become visible. Like, when "James" is selected, show CheckBox1, CheckBox2,...
9
by: Jimbo | last post by:
Hello, I have a user request to build a form in an Access database where the user can check off specific fields to pull in a query. For example, let's say I have 10 fields in a table. The user...
0
by: eyemustbecrazy | last post by:
Hi, I know how to export whole tables as follows... <elsnipo> 'Export This Table strTable = "tblthis" strSql = "SELECT " & strTable & ".* INTO " & strTable & " IN """ &
0
by: daverskully | last post by:
I have two tables created and want to link two forms created from these tables so that specific fields are populated once one field is selected, but not all fields being populated, with a new record...
2
by: daverskully | last post by:
I have two tables created and want to link two forms created from these tables so that specific fields are populated once one field is selected, but not all fields being populated, with a new record...
1
by: Jonnie79 | last post by:
OK, so my XML data looks like this: <xml id = "internalXMLData"> <Contacts> <Contact> <Name>Jonnie Graham</Name> <Phone type="home">(09) 3888...
1
by: Vishal P Patil | last post by:
This is the data in the text file , 8=FIX.4.39=6135=534=149=IDE50=FX52=20101219-18:05:01.52256=SAXOQUOTE10=171...
6
by: Vishal P Patil | last post by:
This is the code that I have written in C# which shows the contains in the sample.log file. class FileRead { public void ReadData() { FileStream fs = new FileStream("sample.log",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.