Logging in Code vs SQL-WHERE was: Row based permissions: at DB or at Application level?

From: Thomas Güttler <guettliml(at)thomas-guettler(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Logging in Code vs SQL-WHERE was: Row based permissions: at DB or at Application level?
Date: 2017-08-01 14:11:35
Message-ID: 2c47f971-bbe0-15aa-432c-81812e34267a@thomas-guettler.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have been thinking about this again.

Doing perm checking in code (I use Python) has the advantage that you can do logging:

def has_perm(item, user):
if user.is_superuser:
logger.debug('Access to %s for %s allowed, since user is superuser' % (item, user))
return True
if ...:
logger.debug('Access to %s for %s allowed, since ...' % (item, user))
logger.debug('Access to %s for %s not allowed.' % (item, user))
return False

We use this sometimes for debugging. This way I can see why a user is allowed to access an object or not.

This is an argument for permission checking in code.

On the other side I still think perm checking in SQL WHERE has more benefits.

Regards,
Thomas Güttler

--
Thomas Guettler http://www.thomas-guettler.de/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-08-01 14:53:15 Re: [GENERAL] Not able to create collation on Windows
Previous Message Tim Uckun 2017-08-01 13:29:56 Re: Shared Constants in PLPGSQL