Skip to content
Snippets Groups Projects

Add option to disable username changing

Merged gitlab-qa-bot requested to merge github/fork/raphendyr/username_changing_disabled into 4-1-stable

Created by: raphendyr

When gitlab is used with ldap or pam for authentication, we might want to disable username changing.

We found out that you can reserve another users username before another user logs in first time and thus disabling the service from him.

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
64 .input
65 = f.text_field :username, required: true
66  
67 %span.loading-gif.hide= image_tag "ajax_loader.gif"
68 %span.update-success.cgreen.hide
69 %i.icon-ok
70 Saved
71 %span.update-failed.cred.hide
72 %i.icon-remove
73 Failed
74 %ul.cred
75 %li It will change web url for personal projects.
76 %li It will change the git path to repositories for personal projects.
77 .input
78 = f.submit 'Save username', class: "btn save-btn"
56 if current_user.can_change_username?
  • Created by: dzaporozhets

    I prefer to create a method in user model. So it looks like - if current_user.can_change_username? ... Same for controller also

    By Administrator on 2013-02-02T19:26:21 (imported from GitLab project)

    By Administrator on 2013-02-02T19:26:21 (imported from GitLab)

  • gitlab-qa-bot
  • 64 .input
    65 = f.text_field :username, required: true
    66  
    67 %span.loading-gif.hide= image_tag "ajax_loader.gif"
    68 %span.update-success.cgreen.hide
    69 %i.icon-ok
    70 Saved
    71 %span.update-failed.cred.hide
    72 %i.icon-remove
    73 Failed
    74 %ul.cred
    75 %li It will change web url for personal projects.
    76 %li It will change the git path to repositories for personal projects.
    77 .input
    78 = f.submit 'Save username', class: "btn save-btn"
    56 if current_user.can_change_username?
    • Created by: raphendyr

      Good idea, looks a lot better. Also makes possible to allow username changing per user (eq. admins).

      I look if I can implement it. Not yet so familiar with ruby nor rails etc.

      By Administrator on 2013-02-02T19:26:21 (imported from GitLab project)

      By Administrator on 2013-02-02T19:26:21 (imported from GitLab)

  • Created by: raphendyr

    Btw. Should I rebase changes I make to single commit?

    By Administrator on 2013-02-02T19:15:03 (imported from GitLab project)

    By Administrator on 2013-02-02T19:15:03 (imported from GitLab)

  • Created by: raphendyr

    Untested! Anycase, is this better?

    By Administrator on 2013-02-02T19:27:40 (imported from GitLab project)

    By Administrator on 2013-02-02T19:27:40 (imported from GitLab)

  • gitlab-qa-bot
  • 215 215 keys.count == 0
    216 216 end
    217 217
    218 def can_change_username?
    219 Gitlab.config.gitlab.username_changing_enabled
    • Created by: raphendyr

      Here we could make decision based on admin status or authentication provider.

      By Administrator on 2013-02-02T19:29:56 (imported from GitLab project)

      By Administrator on 2013-02-02T19:29:56 (imported from GitLab)

  • Created by: dzaporozhets

    thank you. Better now. Can you add some tests?

    By Administrator on 2013-02-03T19:11:43 (imported from GitLab project)

    By Administrator on 2013-02-03T19:11:43 (imported from GitLab)

  • Created by: raphendyr

    I have no idea about the test side of the gitlab/rails/whatever. :D So, I'm sorry, I can't or at least not without lot of effort. I should learn though...

    By Administrator on 2013-02-03T20:16:04 (imported from GitLab project)

    By Administrator on 2013-02-03T20:16:04 (imported from GitLab)

  • Created by: raphendyr

    I looked bit onto testing. Is this something you had in mind? https://gist.github.com/4707649

    By Administrator on 2013-02-04T16:02:00 (imported from GitLab project)

    By Administrator on 2013-02-04T16:02:00 (imported from GitLab)

  • Created by: gliptak

    +1

    By Administrator on 2013-02-11T19:32:14 (imported from GitLab project)

    By Administrator on 2013-02-11T19:32:14 (imported from GitLab)

  • Created by: dzaporozhets

    f*ck its merged in 4.1 stable :(

    By Administrator on 2013-02-13T13:09:17 (imported from GitLab project)

    By Administrator on 2013-02-13T13:09:17 (imported from GitLab)

  • Please register or sign in to reply
    Loading