473,770 Members | 5,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2530
>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.b urditt.org> wrote in message
news:11******** *****@corp.supe rnews.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
2599
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 authentication system using PostgreSQL as the central repository for user and password information. I want to keep a table which contains core user details like the username and password and then use this data
5
1247
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, CheckBox3 Could someone please help with this? Cheers!
9
2905
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 wants to be able to check off anywhere between 1 and all 10 fields in a form and have it return a select query with just the fields that were checked off. There are multiple users, so not all users will be checking off the same fields. Some...
0
1190
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
1356
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 being saved into one of the tables. Tables: 1. StaticInfo contains fields: 1) Department 2) DepartmentNumber 3) AccountExecutive and 7 yes/no fields
2
1824
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 being saved into one of the tables. Tables: 1. StaticInfo contains fields: 1) Department 2) DepartmentNumber 3) AccountExecutive and 7 yes/no fields
1
1877
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 466</Phone> <Phone type ="mobile"/> <Phone type ="work"/>
1
1697
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 8=FIX.4.39=6135=034=549=IDE50=FX52=20101219-18:07:02.50156=SAXOQUOTE10=170 and I want to print only specific values from this text files in C#. The output should like this: 8=FIX.4.3 35=5 52=20101219-18:05:01.522 8=FIX.4.3 35=0 52=20101219-18:07:02.501
6
1982
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", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin);
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.