Search code examples
privilegesdb2-400

List all privileges a user has for a specific table (DB2 AS400)


Using a db2 database hosted on an IBM AS400 Version:V5R4M0 I'm having trouble trying to list permissions a user has on a specific table.

Here IBM lists different ways to do so, but I get a file not found error when using the different examples. Using System i Navigator I do not even see a SYSCAT schema. Browsing the Navigator, the closest I was able to find is a view in SYSIBM called SQLTABLEPRIVILEGES

When I query this view on a specific user, it's only showing for two tables, when the user has privileges on many other tables.

Many solutions I come across do not seem to work because of how old the version being used is and the libraries/tables/views don't exist.

We're transitions legacy RPG applications, and I only know enough to get around the system as needed, and my primary role is a .NET developer. So any help would be appreciated.


Solution

  • Where you got only 2 objects back for the user, try,

    Maybe the user in a group? Use the DSPUSRPRF command from the AS400 command line to find out. Then you can look for the priviliges for the group which the user will have.

    If you look for priviliges for the *PUBLIC user? All users will have access to those objects.

    ASIDE:

    to look at the authorities an object has, dspobjaut lib/obj *type eg. dspobjaut libname/filename *file

    (typing dspobjaut (or any command) at the AS400 command line and then pressing F4 shows the commands parameters. Then F1 anywhere on screen gives you help on the heading and params)

    (typing

    go cmd

    followed by part of a command gives help

    eg.

    go cmdaut

    in this case )

    UPDATE:

    Re. finding out if the user is in a group, this works on my AS400 but it is at release V7R4M0

    SELECT GROUP_PROFILE_NAME FROM qsys2.USER_INFO