I have a database on a Firebird 5.0 server. In the database, I have a view named TEST created by the user ADMIN. This user is an administrator, but does not have full privileges on all metadata. The TEST view retrieves user names from the USERS table. The user STANDARD has privileges on the TEST view and the USERS table. I connect to the database using the STANDARD user. When I try to read data from the TEST view, I get an error that says: no permission for SELECT access to TABLE USERS. Effective user is ADMIN. Is the only solution to grant privileges to the ADMIN user or to create the view as a user who has privileges on all metadata? I want certain users to be able to add new views without having to grant privileges on all the objects those views use. I’ll also add that the database was migrated from version 2.5, where this problem did not occur.
I’ve already tried changing the SQL_SECURITY mode for the entire database, because I thought it was set to DEFINER instead of INVOKER. But that didn’t help. I also tried changing the owner of the view to SYSDBA, but that’s not possible without recreating the view. The only thing that works is granting the ADMIN user privileges on the USERS table. But in version 2.5 this wasn’t necessary. I have many views with a lot of dependencies. These views are created by different users. I’d like users to be able to add views without granting additional privileges, and for whether the STANDARD user can read something to depend on that user’s privileges.
I have a database on a Firebird 5.0 server. In the database, I have a view named TEST created by the user ADMIN. This user is an administrator, but does not have full privileges on all metadata. The TEST view retrieves user names from the USERS table. The user STANDARD has privileges on the TEST view and the USERS table. I connect to the database using the STANDARD user. When I try to read data from the TEST view, I get an error that says: no permission for SELECT access to TABLE USERS. Effective user is ADMIN. Is the only solution to grant privileges to the ADMIN user or to create the view as a user who has privileges on all metadata? I want certain users to be able to add new views without having to grant privileges on all the objects those views use. I’ll also add that the database was migrated from version 2.5, where this problem did not occur.
I’ve already tried changing the SQL_SECURITY mode for the entire database, because I thought it was set to DEFINER instead of INVOKER. But that didn’t help. I also tried changing the owner of the view to SYSDBA, but that’s not possible without recreating the view. The only thing that works is granting the ADMIN user privileges on the USERS table. But in version 2.5 this wasn’t necessary. I have many views with a lot of dependencies. These views are created by different users. I’d like users to be able to add views without granting additional privileges, and for whether the STANDARD user can read something to depend on that user’s privileges.
Regarding the first part of your answer: the ADMIN user connects to the database with the RDB$ADMIN role and has the Administrator checkbox selected in the user manager.
For the second part, here are the scripts showing the assumed view:
OK, to reproduce the problem, you need to do the following:
1. Create user: MYADMIN with password "test" and add this user to RDB$ADMIN role
2. Create user STANDARD with password "test"