Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Users and Roles

John Barrett edited this page Feb 7, 2014 · 3 revisions

How do we ascertain the user class? Are they an admin? A community manager?

Let's have a look at the schema:

ddgc=# \d users
                                            Table "public.users"
           Column           |           Type           |                     Modifiers                      
----------------------------+--------------------------+----------------------------------------------------
 id                         | integer                  | not null default nextval('users_id_seq'::regclass)
 username                   | text                     | not null
 public                     | integer                  | not null default 0
 privacy                    | integer                  | not null default 1
 email_notification_content | integer                  | not null default 1
 admin                      | integer                  | not null default 0
 ghosted                    | integer                  | not null default 1
 ignore                     | integer                  | not null default 0
 email                      | text                     | 
 gravatar_email             | text                     | 
 userpage                   | text                     | 
 data                       | text                     | 
 notes                      | text                     | 
 profile_media_id           | bigint                   | 
 created                    | timestamp with time zone | not null
 updated                    | timestamp with time zone | not null
 roles                      | text                     | default ''::text
 flags                      | text                     | not null default '[]'::text

Well, admin users have the admin field set to 1. When an admin changes user roles, flags is set:

ddgc=# select flags from users where flags != '[]';    
       flags       
       -------------------
        ["forum_manager","idea_manager"]
        (1 row)

What is the roles column for? Stay tuned!

Clone this wiki locally