From 75da61704baa8a71933c307bbb875cfd40d7f621 Mon Sep 17 00:00:00 2001 From: Ricky Ramirez Date: Thu, 8 Aug 2013 14:04:06 -0700 Subject: [PATCH] account: Add employee property. --- r2/r2/lib/app_globals.py | 1 + r2/r2/models/account.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 7152d4aea..badb05700 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -174,6 +174,7 @@ class Globals(object): 'cassandra_seeds', 'admins', 'sponsors', + 'employees', 'automatic_reddits', 'allowed_css_linked_domains', 'authorized_cnames', diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index 05bcc3b70..1ea6ae14c 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -630,6 +630,17 @@ class Account(Thing): ''' return setattr(self, 'received_trophy_%s' % uid, trophy_id) + @property + def employee(self): + """Return if the user is an employee. + + Being an employee grants them various special privileges. + + """ + return (self.name in g.admins or + self.name in g.sponsors or + self.name in g.employees) + class FakeAccount(Account): _nodb = True pref_no_profanity = True