Skip to content
Snippets Groups Projects

User/Group namespaces for projects

Merged gitlab-qa-bot requested to merge namespaces into master

Created by: dzaporozhets

Work In progress. Feel free to review

CHANGELOG:

  • added username field to user
  • rake task to fill usernames based on emails create namespaces for users
  • STI Group < Namespace
  • project has namespace_id
  • Projects with namespaces also namespaced in gitolite
  • Moving project to group will move it under group namespace
  • Moving repos when username changed
  • Ability to move project from namespaces to another

TODO:

  • tests
  • not only admins but a group owners too can add projects to group
  • improve admin area
  • add manage group page in group namespace

Details:

  • Clone: git clone git@localhost:dzaporozhets/projectname.git
  • Web: http://localhost/dzaporozhets/projectname
  1. New project

    Screen

  2. Projects list

    Screen

  3. Account page

    Screen

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: jameswritescode

    Thanks for working on this - you guys rock.

    By Administrator on 2012-11-23T21:44:03 (imported from GitLab project)

    By Administrator on 2012-11-23T21:44:03 (imported from GitLab)

  • Created by: dzaporozhets

    @vsizov the first iteration is complete. I'd like to merge this stuff after review and writing few more tests

    By Administrator on 2012-11-24T20:47:30 (imported from GitLab project)

    By Administrator on 2012-11-24T20:47:30 (imported from GitLab)

  • Created by: riyad

    This is going to be so awesome. :D

    By Administrator on 2012-11-24T20:49:32 (imported from GitLab project)

    By Administrator on 2012-11-24T20:49:32 (imported from GitLab)

  • Created by: Philzen

    Great Stuff... would it make sense to consider #1792 (closed) in context of those changes?

    By Administrator on 2012-11-25T10:01:44 (imported from GitLab project)

    By Administrator on 2012-11-25T10:01:44 (imported from GitLab)

  • Created by: dzaporozhets

    You will not be able to keep one project in several groups. Projects are moved under directory of group or user

    By Administrator on 2012-11-25T10:05:21 (imported from GitLab project)

    By Administrator on 2012-11-25T10:05:21 (imported from GitLab)

  • gitlab-qa-bot
50 36 render action: "edit"
51 37 end
52 38 end
53 39
54 40 def destroy
55 @admin_project.destroy
41 @project.destroy
56 42
57 redirect_to admin_projects_url, notice: 'Project was successfully deleted.'
43 redirect_to projects_url, notice: 'Project was successfully deleted.'
58 44 end
59 45
60 private
46 protected
47
48 def project
  • Created by: vsizov

    this method already exists in application_controller. Am I right?

    By Administrator on 2012-11-25T14:54:09 (imported from GitLab project)

    By Administrator on 2012-11-25T14:54:09 (imported from GitLab)

  • gitlab-qa-bot
  • 23 delegate :name, to: :owner, allow_nil: true, prefix: true
    24
    25 def self.search query
    26 where("name LIKE :query OR code LIKE :query", query: "%#{query}%")
    27 end
    28
    29 def to_param
    30 code
    31 end
    32
    14 class Group < Namespace
    33 15 def users
    34 16 User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
    35 17 end
    18
    19 def human_name
    • Created by: vsizov

      does it make sense?

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab project)

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab)

  • gitlab-qa-bot
  • 23 delegate :name, to: :owner, allow_nil: true, prefix: true
    24
    25 def self.search query
    26 where("name LIKE :query OR code LIKE :query", query: "%#{query}%")
    27 end
    28
    29 def to_param
    30 code
    31 end
    32
    14 class Group < Namespace
    33 15 def users
    34 16 User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
    35 17 end
    18
    19 def human_name
    • Created by: vsizov

      sorry. I've understood.

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab project)

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: vsizov

      I think you can remove this block. It doesn't contain any conditions.

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab project)

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab)

  • gitlab-qa-bot
  • 50 36 render action: "edit"
    51 37 end
    52 38 end
    53 39
    54 40 def destroy
    55 @admin_project.destroy
    41 @project.destroy
    56 42
    57 redirect_to admin_projects_url, notice: 'Project was successfully deleted.'
    43 redirect_to projects_url, notice: 'Project was successfully deleted.'
    58 44 end
    59 45
    60 private
    46 protected
    47
    48 def project
    • Created by: dzaporozhets

      in ApplicationController it used in scope of current_user. In admin area it use global scope

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab project)

      By Administrator on 2012-11-25T14:54:09 (imported from GitLab)

  • Created by: dzaporozhets

    Next command will migrate projects sudo -u gitlab -H rake gitlab:activate_namespaces RAILS_ENV=production Old one will be kept in global namespace Group projects will be moved under group dir All new projects will be saved under username dir unless you specify group

    By Administrator on 2012-11-25T16:34:45 (imported from GitLab project)

    By Administrator on 2012-11-25T16:34:45 (imported from GitLab)

  • Created by: dzaporozhets

    Also make sure you have this one:

    sudo usermod -a -G git gitlab
    sudo usermod -a -G gitlab git

    By Administrator on 2012-11-25T16:36:06 (imported from GitLab project)

    By Administrator on 2012-11-25T16:36:06 (imported from GitLab)

  • Created by: jojosch

    the http(s) clone does not work after installing latest master commit.

    also the url in http(s) clone does not display the user/group "subfolder".

    johannes@johannesDellXPS15:~/tmp
    > git clone https://code.[mydomain].de/jojosch/test.git testing_git
    Cloning into 'testing_git'...
    Username for 'https://code.[mydomain].de': [my_gitlab_email]
    Password for 'https://[my_gitlab_email]@code.[mydomain].de': 
    fatal: Authentication failed

    logfile:

    Started GET "/jojosch/test.git/info/refs?service=git-upload-pack" for 127.0.0.1 at 2012-11-25 18:03:42 +0100
    Started GET "/jojosch/test.git/info/refs?service=git-upload-pack" for 127.0.0.1 at 2012-11-25 18:03:48 +0100
    Started GET "/jojosch/test.git/info/refs?service=git-upload-pack" for 127.0.0.1 at 2012-11-25 18:03:48 +0100

    By Administrator on 2012-11-25T17:04:02 (imported from GitLab project)

    By Administrator on 2012-11-25T17:04:02 (imported from GitLab)

  • Created by: dzaporozhets

    Thank you. Will fix it soon

    By Administrator on 2012-11-25T17:42:53 (imported from GitLab project)

    By Administrator on 2012-11-25T17:42:53 (imported from GitLab)

  • Created by: jameswritescode

    Shouldn't admin users be allowed to pick the namespace of various users as well as their own then modifying a project in the admin?

    By Administrator on 2012-11-26T16:40:03 (imported from GitLab project)

    By Administrator on 2012-11-26T16:40:03 (imported from GitLab)

  • Please register or sign in to reply
    Loading