Re: Support for HTTP Auth?

2015-07-22 Thread Zach Auclair
Hey Christian,

To add more debugging context:
* If I use basic auth against the api with an existing service account, I
can than use the sent cookie against the api again.
* If I auth against the kerberos-protected portion, I am then not able to
use the cookie against the api.

Do you have any thoughts on how I can fix this in the RemoteUserAuthBackend?

Thanks,

On Wed, Jul 22, 2015 at 2:55 PM, Christian Hammond christ...@beanbaginc.com
 wrote:

 Hi Zach,

 I'm not really sure what's going on there. This backend isn't widely-used,
 so it doesn't get a lot of testing.

 Sometimes this stuff depends on your server configuration a bit. Can you
 share any modifications to the generated Apache config you may have (or any
 configuration you have if it's not Apache).

 Thanks,

 Christian

 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - https://www.reviewboard.org
 Beanbag, Inc. - https://www.beanbaginc.com

 -Original Message-
 From: Zach zach...@gmail.com
 Reply: reviewboard@googlegroups.com reviewboard@googlegroups.com
 Date: July 22, 2015 at 8:51:55 AM
 To: reviewboard reviewboard@googlegroups.com
 Subject:  Re: Support for HTTP Auth?

  Sorry to revive this from the dead, but I'm also trying to use the
  `RemoteUserAuthBackend`, but against reviewboard 2.0.X.
 
  I have it working from a I can hit this site and get an account that's
  populated perspective. We ignore the auth config when hitting any /api/
  routes since some scripts would have to jump through hoops to do things
  other than basic auth for that endpoint. The issue I'm fighting with is
  that when the UI makes AJAX requests to the api, even though it sends the
  session cookie and id, returned from the set-cookie header, I get
 prompted
  for a username and password (due to the WWW-Authenticate header).
 
  Do you have any thoughts on this?
 
  On Tuesday, June 8, 2010 at 2:29:29 PM UTC-4, Christian Hammond wrote:
  
   Hi,
  
   Someone worked on patches long ago for this but they were never
 completed.
   They're a bit outdated now given changes in Review Board.
  
   I don't know how your code works, but I believe Django has support for
   HTTP Auth now (django.contrib.auth.backends.RemoteUserAuthBackend). It
   actually doesn't completely do what we need. It'll automatically create
   User objects for any new attempt at login, which is probably bad. What
 I'd
   do is subclass this in our own backends.py file and set
 create_unknown_user
   to False. I'd also create a new variable we can use to hide the Log In
 link
   (maybe hide_login_page or something) and check that in the base.html
   template.
  
   This backend must be used in conjunction with
   django.contrib.auth.middleware.RemoteUserMiddleware. However, the
   middleware assumes that we're absolutely using RemoteUserAuthBackend,
 which
   we won't always be, so you'd also have to subclass that, override
   process_request, and only call the parent method if the HTTP auth
 backend
   is used. That middleware would need to be placed in the middleware
 list in
   reviewboard/settings.py.
  
   You'd then need to update Review Board to know about it
   (reviewboard/admin/siteconfig.py and forms.py, I believe).
  
   Hope that helps.
  
   Christian
  
   --
   Christian Hammond - chi...@chipx86.com
   Review Board - http://www.reviewboard.org
   VMware, Inc. - http://www.vmware.com
  
  
   On Tue, Jun 8, 2010 at 10:27 AM, tuckermi
wrote:
  
   I am trying to configure ReviewBoard (I'm using 1.5b2) to trust the
   REMOTE_USER environment variable that is set by apache when I use
   basic HTTP authentication. Has anyone had luck doing something like
   this who can steer me in the right direction? I have tried writing my
   own backend, which seems like it is probably not the best approach,
   but am running into some issues. Specifically, I am still prompted to
   login with the ReviewBoard login page after I authenticate through the
   HTTP Auth popup.
  
   I would definitely prefer to use existing tools if they exist -- I
   looked through the documentation and didn't see any mention of HTTP
   basic auth as an authentication backend. Is there something in Django
   that I should look at? Any suggestions would be appreciated.
  
   Thanks,
   Mike
  
   --
   Want to help the Review Board project? Donate today at
   http://www.reviewboard.org/donate/
   Happy user? Let us know at http://www.reviewboard.org/users/
   -~--~~~~--~~--~--~---
   To unsubscribe from this group, send email to
   reviewboard...@googlegroups.com
   For more options, visit this group at
   http://groups.google.com/group/reviewboard?hl=en
  
  
  
 
  --
  Supercharge your Review Board with Power Pack:
 https://www.reviewboard.org/powerpack/
  Want us to host Review Board for you? Check out RBCommons:
 https://rbcommons.com/
  Happy user? Let us know! https://www.reviewboard.org/users/
  ---
  You received this message because you are 

Re: Issue Migrating Database from 1.5.5 to 2.0.5 (model updates fail)

2015-04-06 Thread Zach Auclair
Hey Christian,

One of the previous admins told me that we were using reviewboard pre 1.0 -
this may explain where the random sql came from.

Can I get a quote on how much a support contract would cost?

-Zach

On Sat, Apr 4, 2015 at 1:35 AM, Christian Hammond christ...@beanbaginc.com
wrote:

 Hey Zach,

 I basically have this fixed, and will be getting it through a review cycle
 and ready for a new django_evolution release, but I have some concerns
 about your database. It seems to be missing a couple major releases worth
 of evolutions.

 The SQL you found seems to match the missing evolution, so I'm guessing
 someone's been applying them by hand?

 It's absolutely crucial that this be fixed for an upgrade, or things can
 end up quickly in a bad state. Future releases will be increasingly harder
 to upgrade to.

 There's basically two options here:

 1) You can try installing a brand new site, using a brand new database, in
 order to generate a correct set of evolution data. You'd then want to copy
 the contents of these two tables (the same ones you sent me) from the that
 new database to the one you want to upgrade, completely replacing the
 copies in that database.

 2) We can do this for you and deal with any other issues that come up
 along the way, and fully repair your database. We'd have you up and running
 under 2.0 quick. However, we can only do this under a support contract.

 I'll let you know when we have the django_evolution release out. I can
 also send you an early build to test, if you let me know what version of
 Python you're using.

 Christian


 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - http://www.reviewboard.org
 Beanbag, Inc. - http://www.beanbaginc.com

 On Fri, Apr 3, 2015 at 8:47 PM, Christian Hammond 
 christ...@beanbaginc.com wrote:

 I believe I've isolated the problem to a bug in django-evolution. Haven't
 figured out the exact cause just yet, but working on it!

 Christian

 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - http://www.reviewboard.org
 Beanbag, Inc. - http://www.beanbaginc.com

 On Fri, Apr 3, 2015 at 7:35 PM, Christian Hammond 
 christ...@beanbaginc.com wrote:

 Hi Zach,

 I'm sorry, I haven't had any time to make progress on this. Been busy
 with some of our premium support customers, student program, and a few
 other things. I have a couple hours I can spend right now, so I'll see if
 anything stands out.

 Where did those SQL statements come from?

 FWIW, Django Evolution has been around since the 1.0 alphas.

 Christian

 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - http://www.reviewboard.org
 Beanbag, Inc. - http://www.beanbaginc.com

 On Thu, Apr 2, 2015 at 8:13 AM, Zach Auclair zach...@gmail.com wrote:

 Hey Christian,

 Have you been able to make any progress on debugging this? I just
 wanted to point out that I believe before the current version that to
 upgrade to the current version we were on long ago, our previous maintainer
 may have run some migrations by hand (before this had django_evolutions?).

 Some of the sql I found:

 ```
 CREATE INDEX django_session_expire_date ON django_session
 (expire_date);

 ALTER TABLE diffviewer_filediff ALTER COLUMN source_file TYPE
 varchar(1024) USING CAST(source_file as varchar(1024));
 ALTER TABLE diffviewer_filediff ALTER COLUMN dest_file TYPE
 varchar(1024) USING CAST(dest_file as varchar(1024));
 ALTER TABLE diffviewer_diffset ADD COLUMN basedir varchar(256) ;
 UPDATE diffviewer_diffset SET basedir = '' WHERE basedir IS NULL;
 ALTER TABLE diffviewer_diffset ALTER COLUMN basedir SET NOT NULL;
 ALTER TABLE diffviewer_filediff ADD COLUMN status varchar(1) ;
 UPDATE diffviewer_filediff SET status = 'M' WHERE status IS NULL;
 ALTER TABLE diffviewer_filediff ALTER COLUMN status SET NOT NULL;
 ALTER TABLE reviews_reviewrequest ADD COLUMN last_review_timestamp
 timestamp with time zone NULL ;

 UPDATE reviews_reviewrequest
SET last_review_timestamp = (
SELECT reviews_review.timestamp
  FROM reviews_review
 WHERE reviews_review.review_request_id =
   reviews_reviewrequest.id
   AND reviews_review.public
 ORDER BY reviews_review.timestamp DESC
 LIMIT 1);

 ALTER TABLE reviews_reviewrequest ADD COLUMN shipit_count integer ;
 UPDATE reviews_reviewrequest SET shipit_count = 0 WHERE
 shipit_count IS NULL;

 UPDATE reviews_reviewrequest
SET shipit_count = (
SELECT COUNT(*)
  FROM reviews_review
 WHERE reviews_review.review_request_id =
   reviews_reviewrequest.id
   AND reviews_review.public
   AND reviews_review.ship_it
   AND reviews_review.base_reply_to_id is NULL);

 CREATE TABLE reviews_defaultreviewer_repository (
 id serial NOT NULL PRIMARY KEY,
 defaultreviewer_id integer

Re: Issue Migrating Database from 1.5.5 to 2.0.5 (model updates fail)

2015-04-02 Thread Zach Auclair
Hey Christian,

Have you been able to make any progress on debugging this? I just wanted to
point out that I believe before the current version that to upgrade to the
current version we were on long ago, our previous maintainer may have run
some migrations by hand (before this had django_evolutions?).

Some of the sql I found:

```
CREATE INDEX django_session_expire_date ON django_session
(expire_date);

ALTER TABLE diffviewer_filediff ALTER COLUMN source_file TYPE
varchar(1024) USING CAST(source_file as varchar(1024));
ALTER TABLE diffviewer_filediff ALTER COLUMN dest_file TYPE
varchar(1024) USING CAST(dest_file as varchar(1024));
ALTER TABLE diffviewer_diffset ADD COLUMN basedir varchar(256) ;
UPDATE diffviewer_diffset SET basedir = '' WHERE basedir IS NULL;
ALTER TABLE diffviewer_diffset ALTER COLUMN basedir SET NOT NULL;
ALTER TABLE diffviewer_filediff ADD COLUMN status varchar(1) ;
UPDATE diffviewer_filediff SET status = 'M' WHERE status IS NULL;
ALTER TABLE diffviewer_filediff ALTER COLUMN status SET NOT NULL;
ALTER TABLE reviews_reviewrequest ADD COLUMN last_review_timestamp
timestamp with time zone NULL ;

UPDATE reviews_reviewrequest
   SET last_review_timestamp = (
   SELECT reviews_review.timestamp
 FROM reviews_review
WHERE reviews_review.review_request_id =
  reviews_reviewrequest.id
  AND reviews_review.public
ORDER BY reviews_review.timestamp DESC
LIMIT 1);

ALTER TABLE reviews_reviewrequest ADD COLUMN shipit_count integer ;
UPDATE reviews_reviewrequest SET shipit_count = 0 WHERE shipit_count
IS NULL;

UPDATE reviews_reviewrequest
   SET shipit_count = (
   SELECT COUNT(*)
 FROM reviews_review
WHERE reviews_review.review_request_id =
  reviews_reviewrequest.id
  AND reviews_review.public
  AND reviews_review.ship_it
  AND reviews_review.base_reply_to_id is NULL);

CREATE TABLE reviews_defaultreviewer_repository (
id serial NOT NULL PRIMARY KEY,
defaultreviewer_id integer NOT NULL,
repository_id integer NOT NULL,
UNIQUE (defaultreviewer_id, repository_id)
)
;
ALTER TABLE reviews_defaultreviewer_repository ADD CONSTRAINT
defaultreviewer_id_refs_id_51486bbd FOREIGN KEY (defaultreviewer_id)
REFERENCES reviews_defaultreviewer (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE reviews_defaultreviewer_repository ADD CONSTRAINT
repository_id_refs_id_8161d2ae FOREIGN KEY (repository_id) REFERENCES
scmtools_repository (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE reviews_reviewrequest ALTER COLUMN repository_id DROP NOT
NULL;
ALTER TABLE scmtools_repository ADD COLUMN raw_file_url varchar(128) ;
UPDATE scmtools_repository SET raw_file_url = '' WHERE raw_file_url
IS NULL;
ALTER TABLE scmtools_repository ALTER COLUMN raw_file_url SET NOT NULL;
ALTER TABLE scmtools_repository ADD COLUMN visible boolean ;
UPDATE scmtools_repository SET visible = True WHERE visible IS NULL;
ALTER TABLE scmtools_repository ALTER COLUMN visible SET NOT NULL;
ALTER TABLE scmtools_repository ALTER COLUMN path TYPE varchar(255)
USING CAST(path as varchar(255));
ALTER TABLE scmtools_repository ALTER COLUMN mirror_path TYPE
varchar(255) USING CAST(mirror_path as varchar(255));
ALTER TABLE scmtools_repository ALTER COLUMN raw_file_url TYPE
varchar(255) USING CAST(raw_file_url as varchar(255));

 update siteconfig_siteconfiguration set settings='[redacted]';
```

-Zach

On Wed, Feb 11, 2015 at 5:18 PM, Zach Auclair zach...@gmail.com wrote:

 Hey Christian,

 I ran...

 `pg_dump --host dbhost --dbname reviewboard --username reviewboard
 --schema-only  schema-recreate.sql`
 `pg_dump --data-only --table django_project_version --table
 django_evolution --host dbhost --dbname reviewboard --username reviewboard
  django-table-data-import.sql`

 ... and have attached the data.

 Please let me know if you have a more explicit / different way you want
 the data.

 -Zach

 On Wed, Feb 11, 2015 at 4:22 PM, Christian Hammond 
 christ...@beanbaginc.com wrote:

 Hi Zach,

 I wouldn't need any actual confidential data. Just the table schema and
 the contents of the django_evolution and django_project_version tables
 (which solely contain information on the schema, and nothing confidential
 of any sort).

 Christian

 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - https://www.reviewboard.org
 Beanbag, Inc. - https://www.beanbaginc.com

 -Original Message-
 From: Zach zach...@gmail.com
 Reply: Zach zach...@gmail.com
 Date: February 11, 2015 at 1:20:29 PM
 To: reviewboard@googlegroups.com reviewboard@googlegroups.com
 Cc: christ...@beanbaginc.com christ...@beanbaginc.com
 Subject:  Re: Issue Migrating Database from 1.5.5 to 2.0.5 (model updates
 fail)

  Hey Christian,
 
  Sorry for the long delay between responses - I've had to put this
 project

Re: Issue Migrating Database from 1.5.5 to 2.0.5 (model updates fail)

2014-08-21 Thread Zach Auclair
Hey Christian,

Have you had a chance to look into this? Is there any other information I
can get you?

-Zach



On Fri, Aug 15, 2014 at 10:11 PM, Zach Auclair zach...@gmail.com wrote:

 Hi Chris,

 The output of the list-evolutions command is actually included in my
 last paragraph in the original post - see *... in list-evolutions
 form.*

 I have attached the current schema generated by `pg_dump --schema-only
 ...`.


 On Fri, Aug 15, 2014 at 4:37 PM, Christian Hammond 
 christ...@beanbaginc.com wrote:

 Hmm, that shouldn’t be happening. Can you run this and show me what you
 see:

 $ rb-site manage /path/to/site list-evolutions

 Also, can you dump the schema of your database and attach it?

 - Christian

 --
 Christian Hammond - christ...@beanbaginc.com
 Review Board - http://www.reviewboard.org
 Beanbag, Inc. - http://www.beanbaginc.com

 On August 15, 2014 at 12:11:45 PM, Zach (zach...@gmail.com) wrote:

 I'm trying to rb-site upgrade an old 1.5.5 database to 2.0.5.

 *This fails with:*

   Rebuilding directory structure
 Updating database. This may take a while.

 The log output below, including warnings and errors,
 can be ignored unless upgrade fails.

 -- begin log output --
 Creating tables ...
 There are unapplied evolutions for auth.
 There are unapplied evolutions for contenttypes.
 There are unapplied evolutions for sessions.
 There are unapplied evolutions for accounts.
 There are unapplied evolutions for changedescs.
 There are unapplied evolutions for diffviewer.
 There are unapplied evolutions for reviews.
 There are unapplied evolutions for scmtools.
 Project signature has changed - an evolution is required
 Installing custom SQL ...
 Installing indexes ...
 Installed 0 object(s) from 0 fixture(s)
 The stored evolutions do not completely resolve all model changes.

 Run `./manage.py evolve --hint` to see a suggestion for the changes
 required.

 The following are the changes that could not be resolved:
 The application markup has been deleted
 In model reviews.DefaultReviewer:
 In field 'repository':
 Property 'null' has changed
 In model reviews.ReviewRequest:
 In field 'repository':
 Property 'null' has changed
 CommandError: Your models contain changes that Django Evolution cannot
 resolve automatically.


 *The suggested --hint's are:*

   #- Evolution for auth
 from django_evolution.mutations import ChangeMeta, DeleteModel


 MUTATIONS = [
 ChangeMeta('Permission', 'unique_together', ((u'content_type',
 u'codename'),)),
 DeleteModel('Message')
 ]
 #--
 #- Evolution for contenttypes
 from django_evolution.mutations import ChangeMeta


 MUTATIONS = [
 ChangeMeta('ContentType', 'unique_together', (('app_label',
 'model'),))
 ]
 #--
 #- Evolution for sessions
 from django_evolution.mutations import ChangeField


 MUTATIONS = [
 ChangeField('Session', 'expire_date', initial=None, db_index=True)
 ]
 #--
 #- Evolution for accounts
 from django_evolution.mutations import AddField, ChangeMeta, DeleteField
 from django.db import models
 from djblets.db.fields import JSONField


 MUTATIONS = [
 AddField('Profile', 'should_send_email', models.BooleanField,
 initial=True),
 AddField('Profile', 'timezone', models.CharField, initial=u'UTC',
 max_length=30),
 AddField('Profile', 'open_an_issue', models.BooleanField,
 initial=True),
 AddField('Profile', 'extra_data', JSONField, null=True),
 AddField('Profile', 'show_closed', models.BooleanField, initial=True),
 AddField('Profile', 'is_private', models.BooleanField, initial=False),
 DeleteField('Profile', 'show_submitted'),
 ChangeMeta('ReviewRequestVisit', 'unique_together', ((u'user',
 u'review_request'),))
 ]
 #--
 #- Evolution for changedescs
 from django_evolution.mutations import AddField
 from django.db import models


 MUTATIONS = [
 AddField('ChangeDescription', 'rich_text', models.BooleanField,
 initial=True)
 ]
 #--
 CommandError: Cannot use hinted evolution: AddField or ChangeField
 mutation for 'FileDiff.status' in 'diffviewer' requires user-specified
 initial value.

 *The completed evolutions are:*

   reviewboard= select * from django_evolution;
  id | version_id |  app_label  |label

 ++-+-
   1 |  4 | diffviewer  | add_parent_diffs
   2 |  4 | reviews | change_descriptions
   3 |  4 | scmtools| bugzilla_url_charfield
   4 |  5 | attachments | file_attachment_orig_filename
   5 |  5 | attachments | file_attachment_file_max_length_512
   6 |  5 | attachments | file_attachment_repo_info
   7 |  5 | attachments | file_attachment_repo_path_no_index
   8 |  5 | attachments |
 file_attachment_repo_revision_max_length_64
   9 |  5 | site