Project

General

Profile

Actions

Feature #1945

open

Automatically add user to project

Added by James Turnbull over 15 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Start date:
2008-09-25
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

The process of manually adding users to projects can be troublesome sometimes so I wanted to suggest a feature. If a registered user submits a ticket for a particular project then they are automatically added as a member of the project. To handle role access you should be able to specify the default role they would be added as, for example reporter.


Related issues

Related to Redmine - Feature #2722: New user notificationNew2009-02-11

Actions
Actions #1

Updated by Sander Datema over 15 years ago

I second this one. A setting to set what projects are allowed to auto add users would be handy in this case.

Actions #2

Updated by J Cayetano Delgado almost 15 years ago

+1

We have a policy of "all projects private", because we have open the forge for our customers also, but we would like to add automatically some projects for the Members authenticated via LDAP, instead of doing manually.

Actions #3

Updated by Pieter Joost van de Sande about 13 years ago

Is this one still open?

Actions #4

Updated by Ryan Cross about 13 years ago

I am also curious.

The use case for me is that all projects are private by default (client-based) but we have a few key people that are part of every project so they should be automatically added to everyone.

Also, it would be a nice option to specify an admin user who is part of every project just for the ability to manage tickets in arbitrary projects.

Actions #5

Updated by Nicolas Brisac almost 12 years ago

I have the same requirement. Here is the use case for us:

We allow issue creation from email in private projects to user that don't exist in redmine yet.
Mailhandler creates the user and emails him the details to login, but he needs to be manually added to the project to be able to see/update the ticket he's created.

Having the ability to automatically add the newly created user account to the project where he submited the issue (with an arbitrary role) would save us heaps of time.

Actions #6

Updated by Nicolas Brisac almost 12 years ago

ok, here is a how I hacked it.
Obviously a proper option in the one of the Admin sections would be much better.
Or even having the above to set a default and then allow overriding for issues creation by email.

Note: I tested it only with redmine 1.4.2

--- a/app/models/mail_handler.rb  2012-06-06 00:52:03.078284808 +0200
+++ b/app/models/mail_handler.rb  2012-06-06 01:16:04.897929499 +0200
@@ -402,6 +402,11 @@
     if addr && !addr.spec.blank?
       user = self.class.new_user_from_attributes(addr.spec, TMail::Unquoter.unquote_and_convert_to(addr.name, 'utf-8'))
       if user.save
+       member = Member.new
+       member.user = user
+       member.project = Project.find_by_identifier(get_keyword(:project))
+       member.roles = [Role.find_by_name('Reporter')]
+       member.save
         user
       else
         logger.error "MailHandler: failed to create User: #{user.errors.full_messages}" if logger
Actions #7

Updated by Gabriel Pettier over 11 years ago

I had the same issue, tried a somewhat cleaner approach, i added a hook to user creation (by external authentifier), and created a small plugin using this hook.

patch: https://github.com/tshirtman/redmine/commit/790f57d61b379b2966d6f735e00c6e37b96f3eb8

plugin: https://github.com/tshirtman/redmine_new_user_actions

It would be great to have such a hook in Redmine merged. If the hook name I chosen is incorrect, use another one, if i forgot places to add it, i can fix it, just ask, but i would really like something like this to be merged, to have a more future-proof solution.

Actions #8

Updated by Christoffer Järnåker about 10 years ago

That nasty hack from Nicolas also works perfect with 2.2.3
Apply that change starting on 457.

Actions #9

Updated by Brian Kirkpatrick almost 9 years ago

The patch from Pettier's comment 7 is no longer available. I was able to implement a similar feature in v2.2.3 with the following changes:

In app/models/user.rb, insert at L185:

Redmine::Hook.call_hook(:model_user_after_create_success, :user => user)

From your plugin's init.rb, include something like the following:

module RedmineNewUserHook
  class Hooks < Redmine::Hook::Listener
    def model_user_after_create_success(context={})
      [here, do stuff like add user to default projects, etc.]
    end
  end
end

Actions #10

Updated by Toshi MARUYAMA almost 9 years ago

Actions #11

Updated by Yar n over 6 years ago

this is handy and very usefull feature.

Actions

Also available in: Atom PDF