Merge lp://staging/~benoit.pierre/sloecode/incubation into lp://staging/sloecode

Proposed by Thomi Richards
Status: Needs review
Proposed branch: lp://staging/~benoit.pierre/sloecode/incubation
Merge into: lp://staging/sloecode
Diff against target: 885 lines (+261/-74) (has conflicts)
25 files modified
development.ini (+4/-1)
sloecode/bzr/display.py (+13/-4)
sloecode/codehosting/server.py (+10/-0)
sloecode/config/middleware.py (+1/-1)
sloecode/controllers/admin/person.py (+18/-8)
sloecode/controllers/admin/project.py (+2/-0)
sloecode/controllers/person.py (+31/-0)
sloecode/controllers/project.py (+6/-2)
sloecode/controllers/xmlrpc.py (+7/-0)
sloecode/lib/auth.py (+16/-9)
sloecode/lib/helpers.py (+13/-2)
sloecode/lib/predicates.py (+40/-19)
sloecode/lib/security.py (+43/-10)
sloecode/model/person.py (+2/-2)
sloecode/model/project.py (+15/-3)
sloecode/sshserver/launcher.py (+2/-0)
sloecode/templates/admin/person-create.html (+2/-0)
sloecode/templates/admin/person-update.html (+6/-0)
sloecode/templates/admin/project-create.html (+6/-0)
sloecode/templates/admin/project-list.html (+2/-0)
sloecode/templates/admin/project-update.html (+4/-0)
sloecode/templates/login.html (+1/-1)
sloecode/templates/macros/nav.html (+7/-4)
sloecode/templates/person-details.html (+4/-4)
sloecode/templates/project-details.html (+6/-4)
Text conflict in sloecode/codehosting/server.py
To merge this branch: bzr merge lp://staging/~benoit.pierre/sloecode/incubation
Reviewer Review Type Date Requested Status
Thomi Richards (community) Needs Fixing
Review via email: mp+77419@code.staging.launchpad.net

Description of the change

Various changes. I'm creating the merge proposal since I need somewhere to make notes about the changes as I'm scanning through them.

These changes look great - I was thinking of adding similar functionality myself. There's a few places where things need to be tweaked. I'll add comments below, and we can discuss them here, or on IRC. It seems like we're not in similar timezones (I'm currently +1300), so another option may be on the sloecode-developers mailing list.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :
Download full text (3.5 KiB)

Revision 129 & 130 are fine.

Revision 131 looks fine, but I'm a bit concerned about revision 132. I understand that you need to add new users to the sloecode database once they're authenticated, but surely there's a hook in the repoze PAM authentication plugin that can be used for this? In fact, I think it can be easily done by specialising the PAMAuthenticatorPlugin and overriding the authenticate(...) method such that successful authentications are then inserted into the database, if they don't already exist. See:

http://docs.repoze.org/who/1.0/narr.html#writing-an-authenticator-plugin

for more information. Also, while you're doing this, I think it makes sense to set the password in the database correctly - that way one can switch away from PAM authentication in the future and existing accounts will continue to work. Once you're making the change listed above, this should be trivial to implement.

Revisions 133, 134, 135 look fine.

Revision 136: the public_projects() function in sloecode/model/project.py should really use a SQLAlchemy query to get all the public projects, rather than getting all projects and iterating over them. You should be able to do something similar to:

def public_projects():
    return Project.get(public=True)

Unfortunately, whenever we make a database schema change we need to also write a database patch file that is able to alter a live database without deleting the current data. These are simple SQL scripts that make the appropriate changes, and are run as part of the debian package's upgrade scripts. See the existing ones in 'dbpatches/patches/*/' - you need to write one for mysql and one for SQLite. SQLite is a bit more tricky because it doesn't let you alter tables much, but you should be able to adapt an existing patch file for your needs. I'd suggest adding the 'public' column, and setting all projects to private by default.

Also, it would be nice to have some text explaining what a public project is in the template - either as a short string next to the 'Public' checkbox, or as a help page. Something that explains that public projects are readable by anyone with access to the sloecode server, but write access is still restricted to developers and managers. I also wonder whether we should not allow the addition of 'Observers' to a public project - then again, that UI needs to be re-done anyway, so maybe we'll deal with that later.

Finally, this isn't a bug that you've introduced, but in the nav.html file, projects should be listed alphabetically, in a case-insensitive fashion. If you're able to make that change without too much trouble that would be superb!

Rev 137 is great, and has already been merged with trunk.

Rev 138 needs more thought. I'd like users to have some control over whether their branches are public or private.... or maybe this is a config setting?

Revision 139 looks OK, but maybe thumper can comment on this?

Revision 140 - I'd like some more information on the change - it looks potentially good, but I can't see any change in output on my test system... In any case we'd need to get rid of the 'if False' thing ;)

Revision 141 looks good.

Revision 142: Same comment as rev 140 - I'd l...

Read more...

review: Needs Fixing
Revision history for this message
Benoit Pierre (benoit.pierre) wrote :
Download full text (5.9 KiB)

On Thu, 29 Sep 2011 00:45:28 -0000, Thomi Richards <email address hidden> wrote:
> Review: Needs Fixing
>
> Revision 129 & 130 are fine.

OK, I'll create a branch/merge proposal for this.

>
> Revision 131 looks fine, but I'm a bit concerned about revision 132. I
> understand that you need to add new users to the sloecode database
> once they're authenticated, but surely there's a hook in the repoze
> PAM authentication plugin that can be used for this? In fact, I think
> it can be easily done by specialising the PAMAuthenticatorPlugin and
> overriding the authenticate(...) method such that successful
> authentications are then inserted into the database, if they don't
> already exist. See:
>
> http://docs.repoze.org/who/1.0/narr.html#writing-an-authenticator-plugin
>
> for more information.

OK.

> Also, while you're doing this, I think it makes sense to set the
> password in the database correctly - that way one can switch away from
> PAM authentication in the future and existing accounts will continue
> to work. Once you're making the change listed above, this should be
> trivial to implement.

I'm really not sure mirroring the password should be done, or if it's
even possible at all. And how do you handle password changes, where
there are not done through the sloecode web interface?

AFAIK, redmine or reviewboard don't do it when using an external
authentication mechanism (like PAM, LDAP, or ActiveDirectory).

I used PAM because it was easier to setup, but I started by looking at
the LDAP plugin, I think some of the authentication configuration could
be moved to the configuration file.

> Finally, if you're using PAM authentication, how do you change the
> admin password from it's initial, insecure setting?

This is a real problem :) Ideally, the admin account should be special:
always using the internal authentication mechanism, especially if at
some point, LDAP/PAM configuration is available through the web
interface, so you can always login to fix an invalid configuration.

> Revisions 133, 134, 135 look fine.
>
> Revision 136: the public_projects() function in
> sloecode/model/project.py should really use a SQLAlchemy query to get
> all the public projects, rather than getting all projects and
> iterating over them. You should be able to do something similar to:
>
> def public_projects():
> return Project.get(public=True)
>
> Unfortunately, whenever we make a database schema change we need to
> also write a database patch file that is able to alter a live database
> without deleting the current data. These are simple SQL scripts that
> make the appropriate changes, and are run as part of the debian
> package's upgrade scripts. See the existing ones in
> 'dbpatches/patches/*/' - you need to write one for mysql and one for
> SQLite. SQLite is a bit more tricky because it doesn't let you alter
> tables much, but you should be able to adapt an existing patch file
> for your needs. I'd suggest adding the 'public' column, and setting
> all projects to private by default.
>
> Also, it would be nice to have some text explaining what a public
> project is in the template - either as a short string next to the
> 'Public' checkbox, or as...

Read more...

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

> On Thu, 29 Sep 2011 00:45:28 -0000, Thomi Richards <email address hidden> wrote:
> > Also, while you're doing this, I think it makes sense to set the
> > password in the database correctly - that way one can switch away from
> > PAM authentication in the future and existing accounts will continue
> > to work. Once you're making the change listed above, this should be
> > trivial to implement.
>
> I'm really not sure mirroring the password should be done, or if it's
> even possible at all. And how do you handle password changes, where
> there are not done through the sloecode web interface?
>
> AFAIK, redmine or reviewboard don't do it when using an external
> authentication mechanism (like PAM, LDAP, or ActiveDirectory).
>
> I used PAM because it was easier to setup, but I started by looking at
> the LDAP plugin, I think some of the authentication configuration could
> be moved to the configuration file.
>

Good point.

Unmerged revisions

143. By Benoit Pierre

More fine-grained control for projects.

142. By Benoit Pierre

Quick hack: change branches display name.

141. By Benoit Pierre

More fine-grained control for projects.

Read-only access for:
* everybody when project is public
* all project members if project is private

Read/write access for:
* managers and developers of the project

140. By Benoit Pierre

Quick hack: change branches display name.

Use path relative to containing repository, instead of nickname.

139. By Benoit Pierre

Change logfile name to include username when launching 'bzr sc-serve'.

138. By Benoit Pierre

Quick hack to allow read-only access to all user repositories.

137. By Benoit Pierre

Fix "permission denied" trace when accessing another user repository.

136. By Benoit Pierre

Add support for public projects.

A public project will automatically be read-only accessible by all users,
without the need to manually add them as observers.

135. By Benoit Pierre

Remove left-over debug trace in helpers.

134. By Benoit Pierre

Fix user creation to work when password modification is not allowed.

Even when using PAM for authentication, it can still be useful to create users:
- an administrator can manage the details of user creation.
- even if the user don't exist on the PAM side, and won't be allowed to connect
  to the web interface, he may still interact with the code hosting server.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches