1. 24 Feb, 2017 16 commits
    • Timothy Andrew's avatar
      Don't allow deleting a ghost user. · 6fdb17cb
      Timothy Andrew authored
      - Add a `destroy_user` ability. This didn't exist before, and was implicit in
        other abilities (only admins could access the admin area, so only they could
        destroy all users; a user can only access their own account page, and so can
        destroy only themselves).
      
      - Grant this ability to admins, and when the current user is trying to destroy
        themselves. Disallow destroying ghost users in all cases.
      
      - Modify the `Users::DestroyService` to check this ability. Also check it in
        views to decide whether or not to show the "Delete User" button.
      
      - Add a short summary of the Ghost User to the bio.
      6fdb17cb
    • Timothy Andrew's avatar
      Implement final review comments from @DouweM and @rymai · f2ed82fa
      Timothy Andrew authored
      - Have `Uniquify` take a block instead of a Proc/function. This is more
        idiomatic than passing around a function in Ruby.
      
      - Block a user before moving their issues to the ghost user. This avoids a data
        race where an issue is created after the issues are migrated to the ghost user,
        and before the destroy takes place.
      
      - No need to migrate issues (to the ghost user) in a transaction, because
        we're using `update_all`
      
      - Other minor changes
      f2ed82fa
    • Timothy Andrew's avatar
      Remove the default value for the `users.ghost` database column. · 3bd2a98f
      Timothy Andrew authored
      The default (false) is not strictly required, and this lets us avoid a
      potentially expensive migration
      3bd2a98f
    • Timothy Andrew's avatar
      Implement review comments from @rymai and @yorickpeterse · 8f01644f
      Timothy Andrew authored
      1. Refactoring and specs in the `Uniquify` class.
      
      2. Don't use the `AdvisoryLocking` class. Similar functionality is
      provided (backed by Redis) in the `ExclusiveLease` class.
      8f01644f
    • Timothy Andrew's avatar
      Use a `ghost` boolean to track ghost users. · 8e684809
      Timothy Andrew authored
      Rather than using a separate `ghost` state. This lets us have the benefits of
      both ghost and blocked users (ghost: true, state: blocked) without having to
      rewrite a number of queries to include cases for `state: ghost`.
      8e684809
    • Timothy Andrew's avatar
      Implement review comments from @DouweM and @nick.thomas. · 53c34c74
      Timothy Andrew authored
      1. Use an advisory lock to guarantee the absence of concurrency in `User.ghost`,
      to prevent data races from creating more than one ghost, or preventing the
      creation of ghost users by causing validation errors.
      
      2. Use `update_all` instead of updating issues one-by-one.
      53c34c74
    • Timothy Andrew's avatar
      Extract code from `Namespace#clean_path` for ghost user generation. · ca16c373
      Timothy Andrew authored
      1. Create a `Uniquify` class, which generalizes the process of generating unique
         strings, by accepting a function that defines what "uniqueness" means in a
         given context.
      
      2. WIP: Make sure tests for `Namespace` pass, add more if necessary.
      
      3. WIP: Add tests for `Uniquify`
      ca16c373
    • Timothy Andrew's avatar
      Deleting a user shouldn't delete associated issues. · ff19bbd3
      Timothy Andrew authored
      - "Associated" issues are issues the user has created + issues that the
        user is assigned to.
      
      - Issues that a user owns are transferred to a "Ghost User" (just a
        regular user with `state = 'ghost'` that is created when
        `User.ghost` is called).
      
      - Issues that a user is assigned to are moved to the "Unassigned" state.
      
      - Fix a spec failure in `profile_spec` — a spec was asserting that when a user
        is deleted, `User.count` decreases by 1. After this change, deleting a user
        creates (potentially) a ghost user, causing `User.count` not to change. The
        spec has been updated to look for the relevant user in the assertion.
      ff19bbd3
    • Timothy Andrew's avatar
      Don't send notifications to ghost users. · 29540d6f
      Timothy Andrew authored
      We already skip sending notifications to blocked users. Simply add ghost users
      to this list.
      29540d6f
    • Timothy Andrew's avatar
      Add CE CHANGELOG for #12726. · 1854c3f7
      Timothy Andrew authored
      1854c3f7
    • Kamil Trzciński's avatar
      Merge branch '27762-add-default-artifacts-expiration' into 'master' · e055f5cd
      Kamil Trzciński authored
      Artifact Expiration Defaults
      
      Closes #27762
      
      See merge request !9219
      e055f5cd
    • Grzegorz Bizon's avatar
      Merge branch 'patch-15' into 'master' · c6ac7391
      Grzegorz Bizon authored
      Fixed instructions for adding Secret Variables to a CI/CD pipeline.
      
      See merge request !9480
      c6ac7391
    • Fatih Acet's avatar
      Merge branch '27530-fix-job-dropdown-pipeline-console-error' into 'master' · a2a4fb85
      Fatih Acet authored
      fixes job dropdown action button error
      
      Closes #27530
      
      See merge request !9182
      a2a4fb85
    • Lin Jen-Shin's avatar
    • Lin Jen-Shin's avatar
      ac531c0e
    • Lin Jen-Shin's avatar
      Merge remote-tracking branch 'upstream/master' into 27762-add-default-artifacts-expiration · 83418ad8
      Lin Jen-Shin authored
      * upstream/master: (247 commits)
        Switched CONTRIBUTING.md style guide recommendation for method chaining
        Fix new offenses
        Stylistic tweaks
        Fix OAuth/SAML user blocking behavior
        Revert "Enable Style/DotPosition"
        Revert "Prefer leading style for Style/DotPosition"
        Revert "Enable Style/BarePercentLiterals"
        Manually correct autocorrect
        Move up delegate calls
        Exclude migrations from Style/MutableConstant
        ActiveSupport delegation is preferred over Forwardable
        Update haml_lint to work with newest rubocop
        Add explanations to cops
        Update rubocop and rubocop-rspec and regenerate .rubocop_todo.yml
        Update rubocop and rubocop-rspec and regenerate .rubocop_todo.yml
        Order cops alphabetically
        Don’t exclude some file in lib from rubocop
        Fix new offenses
        Enable Rails/Delegate
        Enable Style/WordArray
        ...
      83418ad8
  2. 23 Feb, 2017 24 commits