12
返回列表 发新帖
楼主: manplx

怎样按记录授权?

[复制链接]
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
11#
发表于 2001-12-28 13:39 | 只看该作者
I think,
1) create a table include user_id, eg, table1
2) create a view, eg view1
   select *
   from   table1
   where  user_id = user;
3) for anybody can select, insert, update for his owner records,
   grant select, insert, update on view1 to him
4) for anybody can select all the records
   grant select on table1 to him
5) for anybody can select, update, insert all the records
   grant select,insert, update on table1 to him

使用道具 举报

回复
论坛徽章:
0
12#
发表于 2002-1-12 14:09 | 只看该作者

我对 oldwain 的回答的一点解释……

oldwain 的回答是正确的。
他说:“ 按记录授权是view的典型用途之一。”

在这里,我详细的说明一下视图的功能,参照我的一篇帖子《“视图的功能”》。
http://www.itpub.net/showthread.php?s=&postid=61621#post61621

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
13#
 楼主| 发表于 2002-1-12 16:01 | 只看该作者

thanks

I have a clear picture of it, thanks to all,thanks.

使用道具 举报

回复
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:332015年新春福章
日期:2015-03-04 14:19:112015年新春福章
日期:2015-03-06 11:57:31
14#
发表于 2002-1-13 10:13 | 只看该作者
follow ANSI SQL  Standard.
You must create some VIEW to overcome that it is the best way.
另外補充一下
The create view is like logical file in IBM AS/400.
The create table is like phyical file in IBM AS/400.

使用道具 举报

回复
论坛徽章:
5
ITPUB元老
日期:2005-02-28 12:57:00会员2006贡献徽章
日期:2006-04-17 13:46:34会员2007贡献徽章
日期:2007-09-26 18:42:10奥运会纪念徽章:铁人三项
日期:2008-07-22 09:21:48
15#
发表于 2002-1-13 12:22 | 只看该作者
Example:
1, create user BASE identified by base;
    create user test1231 identified by test1231;
   create user test0112 identified by test0112;

   grant connect, resource to base, test1231, test0112;

2, connect base/base

  create table test_abc(
  pk number(5) primary key,
  name varchar2(10),
   userid varchar2(30) default user);

CREATE OR REPLACE TRIGGER Gen_test_abc_userid
   Before INSERT ON test_abc
   FOR Each Row
begin
:new.userid:=user;
END;

   create view test_abc_v
     as select * from test_abc where userid=user

   grant all on test_abc_v to test1231, test0112;

3, if you connect test1231/test1231, you can just use records created by test1231;

4, if you connect test0112/test0112, you can just use records created by test0112;

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
16#
发表于 2002-1-13 23:41 | 只看该作者
我觉得用视图好一些,在进行编程试方便,同时修改也比较方便.

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
17#
发表于 2002-1-16 02:10 | 只看该作者
最初由 ysc7305 发布
[B]我觉得用视图好一些,在进行编程试方便,同时修改也比较方便. [/B]


我认为,任何应用程序访问数据库,都应通过VIEW来实现。应该成为开发者的一种习惯和工作小组的规范。

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表