Re: [gitorious] losing repos when transferring

2012-12-19 Thread Marius Mårnes Mathiesen

Ken Dreyer writes:
 On Tue, Dec 11, 2012 at 1:32 AM, Marius Mårnes Mathiesen
 zmalltal...@zmalltalker.com wrote:
 Whether it is or not, I would suggest that we change it to
 either create a new committership or change the permissions to the
 existing one, but I'd like to know if that was the cause or you found
 another bug.

 I agree. In my mind the concept of owner should imply full rights.
 Should we just remove the unless committerships.any conditional
 around the create_for_owner() call in app/models/repository.rb ?

Well, we'll probably have to 1) either find an existing committership or
initialize a new one and then 2) set up the correct permissions for
that. Simply removing the if clause would result in no committership
being set up at all.

I've filed an issue for this: https://issues.gitorious.org/issues/144
and assigned myself to it; should be resolved fairly soon. Feel free to
comment on the issue in case I forgot something.

Cheers,
- Marius

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com


Re: [gitorious] losing repos when transferring

2012-12-14 Thread Ken Dreyer
On Tue, Dec 11, 2012 at 1:32 AM, Marius Mårnes Mathiesen
zmalltal...@zmalltalker.com wrote:
 However, there's an if clause around that call: `unless
 committerships.any?{|c|c.committer == another_owner}` which means that
 if the new owner already has access to the repository, a new
 committership is not created. Could this be what happened on your
 server?

Thank you very much for the detailed explanation.

Unfortunately I was not personally involved in the transfer actions,
and I asked the person who did the transfers. He said that the groups
were not on the ACL at the time, so maybe there was another reason.

 Whether it is or not, I would suggest that we change it to
 either create a new committership or change the permissions to the
 existing one, but I'd like to know if that was the cause or you found
 another bug.

I agree. In my mind the concept of owner should imply full rights.
Should we just remove the unless committerships.any conditional
around the create_for_owner() call in app/models/repository.rb ?

- Ken

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com


Re: [gitorious] losing repos when transferring

2012-12-11 Thread Marius Mårnes Mathiesen
On Mon, Dec 10, 2012 at 11:05:15AM -0700, Ken Dreyer wrote:
 Context: I've got an intranet Gitorious instance set up, with a couple
 self-managed teams.

 I just had some users lose access to some repos when they transferred
 the repos to a team. Even though these users were members of the group
 which was the Owner, the users still had no admin rights to the
 repo. I had to explicitly add the team in the committership table in
 MySQL.

Ken,
The permission model in Gitorious uses a fancy join table to connect a
user/team and a repository, this table is represented in the
Committership class. For each committership (the connection between a
user/team and a repository), there's a permissions property (similar
to Unix file permissions) which determine what the user/team is
allowed to do with the repository.

 Should a group owner for a repo mean that everyone in the group
 implicitly has admin rights on that repo? I'm wondering if this is a
 bug or if it's intentional.

Now onwards to your question :-)
I would agree with you that a group owner should have admin rights to
that repository. Transferring ownership to a group involves calling
`change_owner_to!` on the Repository class, which *should* cause a
comittership to be created (`committerships.create_for_owner!`), which
would set up a committership with all permissions:

# app/models/committership.rb
  def self.create_for_owner!(an_owner)
cs = new({:committer = an_owner})
cs.permissions = (CAN_REVIEW | CAN_COMMIT | CAN_ADMIN)
cs.save!
cs
  end


However, there's an if clause around that call: `unless
committerships.any?{|c|c.committer == another_owner}` which means that
if the new owner already has access to the repository, a new
committership is not created. Could this be what happened on your
server? Whether it is or not, I would suggest that we change it to
either create a new committership or change the permissions to the
existing one, but I'd like to know if that was the cause or you found
another bug.

Cheers,
- Marius

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com


[gitorious] losing repos when transferring

2012-12-10 Thread Ken Dreyer
Context: I've got an intranet Gitorious instance set up, with a couple
self-managed teams.

I just had some users lose access to some repos when they transferred
the repos to a team. Even though these users were members of the group
which was the Owner, the users still had no admin rights to the
repo. I had to explicitly add the team in the committership table in
MySQL.

Should a group owner for a repo mean that everyone in the group
implicitly has admin rights on that repo? I'm wondering if this is a
bug or if it's intentional.

- Ken

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com