开发者

Table right: is it possible to write protect on row basis?

Could we limit a table right, so only user that created a record CAN update/delete that record?

For example, table A (f integer).

We have 2 users: user1 开发者_开发百科and user2.

User1 added this row:

A

1

User2 added this row:

A

2

So, only user1 can update/delete the '1' record,

and only user2 can update/delete the '2' record.

(Both user1 and user2 has insert/update/delete right on table A).

Thank you.


Hmmmmm I have a membersystem, where CMS can do all, but the "owner" of the row, must use a SHA1 key generated on INSERT Then when doing UPDATE/DELETE - you need to do the logic with SQL

UPDATE ROW ... WHERE sha1 = sha1

Use USER in place of sha1 key ?

Is that a solution ?

Mike


Row level access rights are possible, but it's a bit more complicated. You need to use a view that filters rows for the given session or user. If you also need write access, you need to use an 'instead of trigger' that emulates an updatable view. Here is an example:

http://code.google.com/p/h2database/source/browse/trunk/h2/src/test/org/h2/samples/RowAccessRights.java

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜