将所有表上的SELECT授予Firebird 2.1中的用户 [英] Granting SELECT on all tables to a user in Firebird 2.1

查看:177
本文介绍了将所有表上的SELECT授予Firebird 2.1中的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 gsec 将用户添加到Firebird 2.1实例中,但是现在我想将所有表上的SELECT授予该新用户.我可以找到如何在特定表上授予此权限,而不是全部授予它们:

I've added a user to a Firebird 2.1 instance using gsec, but now I wanted to grant SELECT on all tables to this new user. I could find how to grant this permission on specific tables, but not to them all:

GRANT SELECT ON TABLE table TO USER user;

如果我尝试使用新用户,则会在isql上收到以下错误:

If I try to use the new user I get the following error on isql:

没有对表

有没有办法在Firebird 2.1上做到这一点?

Is there a way to do that on Firebird 2.1?

推荐答案

类似以下内容:

EXECUTE BLOCK
AS
  DECLARE VARIABLE tablename VARCHAR(32);
BEGIN
  FOR SELECT rdb$relation_name
  FROM rdb$relations
  WHERE rdb$view_blr IS NULL
  AND (rdb$system_flag IS NULL OR rdb$system_flag = 0)
  INTO :tablename DO
  BEGIN
    EXECUTE STATEMENT ('GRANT SELECT ON TABLE ' || :tablename || ' TO USER TEST');
  END
END

这篇关于将所有表上的SELECT授予Firebird 2.1中的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆