Project

General

Profile

Actions

Feature #3848

closed

Permission to log time for another user

Added by Cedric VINCENT over 14 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Time tracking
Target version:
Start date:
2009-09-11
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

This patch allows the current user to record the time spent by another one, as you can see in timelog1.png and timelog2.png I wrote this patch because my co-workers are too lazy busy to update their issues ;)

I never programmed in Ruby before this patch, so feel free to rewrite it at your convenience. Maybe an exception should be thrown in the controllers if the current user tries to edit a time entry he is not allowed to, even if it is already checked in the views.


Files

timelog1.png (18.2 KB) timelog1.png Cedric VINCENT, 2009-09-11 15:59
timelog2.png (10.8 KB) timelog2.png Cedric VINCENT, 2009-09-11 15:59
0001-Allow-the-current-user-to-record-the-time-spent-by-a.patch (5.14 KB) 0001-Allow-the-current-user-to-record-the-time-spent-by-a.patch Cedric VINCENT, 2009-09-11 15:59
0002-Access-params-time_entry-only-if-editing-a-time-entr.patch (1.1 KB) 0002-Access-params-time_entry-only-if-editing-a-time-entr.patch Cedric VINCENT, 2009-09-21 16:48
0003-Allow-to-change-the-owner-a-protected-attribute-of-a.patch (1.06 KB) 0003-Allow-to-change-the-owner-a-protected-attribute-of-a.patch Cedric VINCENT, 2009-09-21 16:48
Allow-the-current-user-to-record-the-time-spent-0.9.3.patch (4.73 KB) Allow-the-current-user-to-record-the-time-spent-0.9.3.patch For redmine-0.9.3 Oleg Volkov, 2010-03-14 09:11
time-spent-by-another-user-v.0.1.path (4.02 KB) time-spent-by-another-user-v.0.1.path For redmine-0.9.3 Oleg Volkov, 2010-03-14 11:44
time-spent-by-another-user-v.0.2.patch (2.64 KB) time-spent-by-another-user-v.0.2.patch Oleg Volkov, 2010-03-18 12:04
log-time-for-another-user.diff (3.25 KB) log-time-for-another-user.diff Jack T, 2011-03-21 08:45
patch-3848_log-time-for-others-users-ld.diff (3.37 KB) patch-3848_log-time-for-others-users-ld.diff Lars Dornheim, 2011-08-05 05:57
log-time-for-other-users.diff (5.71 KB) log-time-for-other-users.diff Allow users with permission for edit time entries to log time for other users. Bishma Stornelli Ortega, 2013-03-13 18:36
log-time-for-other-users.diff (5.52 KB) log-time-for-other-users.diff Gary Watson, 2013-07-08 23:12
log-time-for-other-users.diff (4.47 KB) log-time-for-other-users.diff Paul Freund, 2014-02-18 14:42
redmine_foreign_timelog.patch (3.07 KB) redmine_foreign_timelog.patch Patrik Halfar, 2015-01-29 23:05
redmine_3_2_log_time_for_others.patch (3.65 KB) redmine_3_2_log_time_for_others.patch Andor Tóth, 2016-07-29 13:25
redmine_3_4_log_time_for_others.patch (3.71 KB) redmine_3_4_log_time_for_others.patch Andrei Melis, 2018-02-12 10:46
new_log_time.png (67.8 KB) new_log_time.png Marius BĂLTEANU, 2018-05-05 23:18
filter_and_columns.png (236 KB) filter_and_columns.png Marius BĂLTEANU, 2018-05-05 23:18
permissions.png (40.2 KB) permissions.png Marius BĂLTEANU, 2018-05-05 23:20
0001-Allow-the-current-user-to-log-time-for-other-users.patch (24.1 KB) 0001-Allow-the-current-user-to-log-time-for-other-users.patch Marius BĂLTEANU, 2018-06-21 23:16
fix_locales.diff (28 KB) fix_locales.diff Marius BĂLTEANU, 2018-12-16 19:29

Related issues

Related to Redmine - Feature #8505: Log Time for Multiple UsersNewMarius BĂLTEANU2011-06-02

Actions
Related to Redmine - Patch #32196: Allow import time entries for other usersClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #32774: Creating time tracking entry for other user through rest API fails with 403ClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #32959: Fix selected user on log time edit page when user has permissions to log time for another userClosedGo MAEDA

Actions
Related to Redmine - Defect #32973: Editing a time entry for a locked user changes the user to the current userClosedJean-Philippe Lang

Actions
Related to Redmine - Feature #3800: Editing time entries should show the person involvedClosedJean-Philippe Lang2009-09-01

Actions
Has duplicate Redmine - Feature #10753: Abiliy to log time spent for other userClosed

Actions
Has duplicate Redmine - Feature #27328: edit the time of the userClosed

Actions
Has duplicate Redmine - Feature #7239: Allow some users to add / edit time entries on behalf of other usersClosed2011-01-06

Actions
Has duplicate Redmine - Feature #9276: Log Time on an issue assigned to otherClosed2011-09-19

Actions
Has duplicate Redmine - Feature #6486: Log time for other usersClosed2010-09-25

Actions
Actions #1

Updated by Cedric VINCENT over 14 years ago

Patch to apply against redmine-0.8.4

Actions #2

Updated by Eric Davis over 14 years ago

  • Category set to Time tracking

Thank you, that's a good feature. We'll need to update the patch to apply to trunk. I'm not sure if the edit time entries permission should be used or if a new one should be created.

Actions #3

Updated by Jean-Philippe Lang over 14 years ago

I think a new permission would be required if we add this feature.

Actions #4

Updated by Cedric VINCENT over 14 years ago

Oops! There are two bugs in the previous patch, here come the corresponding fixes:

  1. Access params[:time_entry] only if editing a time entry. It fixes the error "ActiveRecord::RecordNotFound".
  2. Allow to change the "owner" of a time entry. Previously, the "owner" was not changed because it is a protected attribute.

Cheers,
Cedric.

Actions #5

Updated by Oleg Volkov about 14 years ago

You can update the patch to version 0.9.3?

Actions #6

Updated by Oleg Volkov about 14 years ago

This patch is not entirely correct, since there is no information who (instead of the user) has made him the information. In addition, there is a need to create new questions and make comments from another user. Both questions are needed when the user is not possible to do it yourself, and he asked the operator to do so by phone.

Actions #8

Updated by Oleg Volkov about 14 years ago

This path is changed:
1. Allow change user only entry/edit "Spent time" (http://www.redmine.org/attachments/2520/timelog1.png) and disabled from Issue Update (http://www.redmine.org/attachments/2521/timelog2.png).
2. Select only users with permission to add record time. (Excluded admin!)

TODO: Logged real user name.

Actions #9

Updated by Oleg Volkov about 14 years ago

I created a new version of the patch.
The patch is shorter.

Actions #10

Updated by Arnaud Lesauvage about 13 years ago

I'm very interested in this patch. Is the patch submitted by Oleg still working ?
We are running redmine against trunk r4359.

I still think this is a very useful feature. In our company, we have projects where the workers do not encode their spent times themselves.
Eric and Jean-Philippe both have shown interest in this so I am hopeful in seeing this integrated in trunk ?

Actions #11

Updated by Jack T about 13 years ago

Updated Oleg's patch to work on Redmine 1.1.0.

I'm new to Redmine, and one of the updates I made to Oleg's patch was in app/controllers/timelog_controller.rb, I made changes to both def new and def create sections instead of @def edit.

Actions #12

Updated by Lars Dornheim over 12 years ago

The last patch did not work for my Redmine 1.1.0.stable.4761, so I adapted it a little bit to work with my Redmine. Furthermore editing of the user field of existing time logs now works for me, too.

Actions #13

Updated by Pavel Potcheptsov over 11 years ago

Is there any plan to include this in current?

Actions #14

Updated by Pavel Potcheptsov about 11 years ago

this worked for 1.3.3
but unfortunately last patch doesn't work with current 2.x.x
any suggestions?

Actions #15

Updated by Bishma Stornelli Ortega about 11 years ago

I update the patch to work with version 2.2.1. I haven't tested in any other version.

Some changes were added. In a nutshell, this patch does:

  • Allow users with permission :edit_time_entries to log time in a project for another user assigned to that project and with permission to log time.
  • Since an admin does not need to be assigned to a project to log time in it, he/she will be added to the select list of users as "<< me >>"
  • The label << me >> will appear in the select list if the available users include the current user (or if current user is admin as mentioned before).
  • These log can be done either through /projects/identifier/time_entries/new or when updating an issue. Maybe I'll add later the option to update through /time_entries/new but it will require a little adittional work.

Let me know if you find any bug.

Actions #16

Updated by Toshi MARUYAMA about 11 years ago

  • Tracker changed from Patch to Feature
Actions #17

Updated by Daniel Felix about 11 years ago

Maybe this could be a candidate for 2.4?

Actions #18

Updated by Cassiano Monteiro about 11 years ago

Agreed. This is definitely something I need (my co-workers are very lazy on logging their times).

Actions #19

Updated by Gary Watson over 10 years ago

A slightly updated diff that works with redmine 2.3.1 There was a small modification I had to make by hand to get the patch to apply otherwise it's the same as the one produced by Bishma Stornelli Ortega that worked with 2.2.1

Actions #20

Updated by Maximilian Schwerin over 10 years ago

The last patch requires ruby >= 1.9.2.

+1 for including this in asap

Actions #21

Updated by Paul Freund about 10 years ago

The patch from Gary Watson also works with version 2.4.2 if you remove the diff for issue.rb. I've attatched an updated patch. All use cases we tested worked but I can't guarantee it works in all.

Actions #22

Updated by Pavel Potcheptsov almost 10 years ago

Paul Freund wrote:

The patch from Gary Watson also works with version 2.4.2 if you remove the diff for issue.rb. I've attatched an updated patch. All use cases we tested worked but I can't guarantee it works in all.

is there any plan to include this functionality in trunk?

Actions #23

Updated by Alex Dergachev over 9 years ago

I just threw together a hacky plugin that seeks to achieve the same thing
It doesn't check any permissions and probably has other bugs, but it works for us on redmine 2.6 without hacking core:

https://github.com/evolvingweb/redmine_timesheet_log_user

Actions #24

Updated by Patrik Halfar about 9 years ago

Hi all,
for latest version 2.6.1 I'm using following patch, is has origin in patch from this feature request, but include separete permisson, so it is possible permit this functionality for some roles only.

Intersting should be add functionality requested by #8505.

Actions #25

Updated by Josh Ovett about 9 years ago

We tested Patrick Halfars patch, Redmine_foreign_timelog.patch and it breaks redmine 2.6.1.

Actions #26

Updated by Henry Auffahrt almost 9 years ago

+1 is there a plugin for that?

Our Admin only want to implement plugins and no patch files. Thanks a Lot!

Actions #27

Updated by Pavel Potcheptsov almost 9 years ago

Unfortunately this path doesn't work in redmine 3.x.
If you select another person you want to log time for, you'll get time entries logged by yourself and not by that person.

Actions #28

Updated by Alexander Ryabinovskiy over 8 years ago

We use this plugin http://www.redmine.org/plugins/redmine_work_time with Redmine 3.1.0. It allows to add / edit work time of another users. But it is not very simple, please add this functionality to Redmine core!

Actions #29

Updated by Александр Скворцов about 8 years ago

How select collection: assigned and current user only?

Actions #30

Updated by Andor Tóth over 7 years ago

I have updated Patrik's patch for 3.2.0.stable.

Actions #31

Updated by Toshi MARUYAMA over 6 years ago

Actions #32

Updated by Andrei Melis about 6 years ago

Edited the patch above for 3.4 (tested on 3.4.2)

Actions #33

Updated by Grant Ferley almost 6 years ago

My Synology docker Redmine recently went to 3.3.6-1 so instead of manually patching I just put it in a plugin. I'll be adding my own custom stuff, but for now the master version is just a plugin for Patrik's 3.2 patch. YMMV, and it's my first attempt at ruby and Redmine plugins.
https://github.com/gferley/redmine_ferplugin

Actions #34

Updated by Hans Kaiser almost 6 years ago

Grant Ferley wrote:

My Synology docker Redmine recently went to 3.3.6-1 so instead of manually patching I just put it in a plugin. I'll be adding my own custom stuff, but for now the master version is just a plugin for Patrik's 3.2 patch. YMMV, and it's my first attempt at ruby and Redmine plugins.
https://github.com/gferley/redmine_ferplugin

great! do you know if your plugins supports also redmine 3.2.1. If so I can be your alpha tester...

By the way, the issue is already 8 years old. Is there any plan to integrate this patch into latest 3.x branch or maybe even into 4.0 branch?

Actions #35

Updated by Marius BĂLTEANU almost 6 years ago

I made a new patch for this feature (inspired from the existing ones) which is more complete from my point of view.

The patch:
- adds a new column ('author_id') to the time entries table where the user who logs the time spent is saved. For the existing entries, author_id will be filled with the user_id during the migration. I found this change a must for this feature.
- makes this new column available in the columns list and filters (from Spent time tab)
- renames the permission to "Add time logs for other users"
- adds tests
- adds the user field only in the new log time page. I don't find it necessary to add the select field also to the time log section from the issue edit page.

Some screenshots attached.

This feature is long requested and it has multiple duplicate issues.

Actions #36

Updated by Marius BĂLTEANU almost 6 years ago

  • Related to deleted (Feature #7239: Allow some users to add / edit time entries on behalf of other users)
Actions #37

Updated by Marius BĂLTEANU almost 6 years ago

  • Has duplicate Feature #7239: Allow some users to add / edit time entries on behalf of other users added
Actions #38

Updated by Marius BĂLTEANU almost 6 years ago

  • Related to deleted (Feature #9276: Log Time on an issue assigned to other)
Actions #39

Updated by Marius BĂLTEANU almost 6 years ago

  • Has duplicate Feature #9276: Log Time on an issue assigned to other added
Actions #40

Updated by Marius BĂLTEANU almost 6 years ago

Actions #41

Updated by Marius BĂLTEANU almost 6 years ago

Actions #42

Updated by Go MAEDA almost 6 years ago

Marius, thank you for your great work. This is one of the long-awaited features.

The patch 0001-Allow-the-current-user-to-log-time-for-other-users.patch works almost fine, however, I found only one small issue. Users who don't have "Log spent time" permission should not be able to access TimelogController#new page, however, they can access the page via "+" button if they have "Log time for other users" permission. They can fill the form but they will see 403 error after hitting "Create" button.

Actions #43

Updated by Go MAEDA almost 6 years ago

  • Target version set to Candidate for next major release
Actions #44

Updated by Marius BĂLTEANU almost 6 years ago

  • File 0001-Allow-the-current-user-to-log-time-for-other-users.patch added

Thanks for pointing this out. I've fixed the issue in the attached patch.

Actions #45

Updated by Marius BĂLTEANU almost 6 years ago

  • File deleted (0001-Allow-the-current-user-to-log-time-for-other-users.patch)
Actions #46

Updated by Go MAEDA almost 6 years ago

  • Target version changed from Candidate for next major release to 4.1.0

Now the patch series looks good. Setting target version to 4.1.0.

Actions #47

Updated by Holger Just almost 6 years ago

I really like the idea of this feature and would love to have the ability to log time for other users in Redmine. Good job on polishing the patch and making it ready for inclusion, Marius!

I still have some behavior-related comments about the latest patch by Marius from #3848-44:

  • If the current user doesn't have the permission to edit time entries for other users, I would rather see the creation / edit of a time entry rejected rather than silently logged to the current user, e.g. with a validation error. The currentlt defined behavior could lead to unexpected data, esp. when used via the API
  • TimelogHelper#user_collection_for_select_options should probably use collection = project.members.active.map(&:user) to ensure that locked users don't show up in the list of users
  • The list of allowed users should be checked with a validation on the TimeEntry model too in order to prevent someone assigning hours to arbitrary users.
  • In the TimelogController#create action, we will see an exception if somene (e.g. via the API) doesn't correctly provide params[:time_entries]. This case should be handled.
Actions #48

Updated by Go MAEDA almost 6 years ago

  • Assignee set to Marius BĂLTEANU
  • Target version changed from 4.1.0 to Candidate for next major release
Actions #49

Updated by Marius BĂLTEANU almost 6 years ago

Holger Just wrote:

I really like the idea of this feature and would love to have the ability to log time for other users in Redmine. Good job on polishing the patch and making it ready for inclusion, Marius!

I still have some behavior-related comments about the latest patch by Marius from #3848-44:

  • If the current user doesn't have the permission to edit time entries for other users, I would rather see the creation / edit of a time entry rejected rather than silently logged to the current user, e.g. with a validation error. The currentlt defined behavior could lead to unexpected data, esp. when used via the API
  • TimelogHelper#user_collection_for_select_options should probably use collection = project.members.active.map(&:user) to ensure that locked users don't show up in the list of users
  • The list of allowed users should be checked with a validation on the TimeEntry model too in order to prevent someone assigning hours to arbitrary users.
  • In the TimelogController#create action, we will see an exception if somene (e.g. via the API) doesn't correctly provide params[:time_entries]. This case should be handled.

Thanks Holger for your feedback. I'll update my patch these days to integrate your feedback.

Actions #50

Updated by Marius BĂLTEANU almost 6 years ago

I've reworked my patch in order to include the issues reported by Holger Just.

Actions #51

Updated by Marius BĂLTEANU almost 6 years ago

  • File deleted (0001-Allow-the-current-user-to-log-time-for-other-users.patch)
Actions #52

Updated by Marius BĂLTEANU almost 6 years ago

  • Target version changed from Candidate for next major release to 4.1.0
Actions #53

Updated by Go MAEDA over 5 years ago

  • Assignee set to Jean-Philippe Lang
Actions #54

Updated by Jean-Philippe Lang over 5 years ago

  • Subject changed from Allow the current user to record the time spent by another one. to Permission to log time for another user
  • Status changed from New to Closed
  • Resolution set to Fixed

Patch is committed, thanks for your work on this feature.

Actions #55

Updated by Marius BĂLTEANU over 5 years ago

Jean-Philippe, please apply the attached patch in order to update the translation for error_not_allowed_to_log_time_for_other_users also for the generated locales. I think that you first generated the locales and after that you have changed the en translation.

Actions #56

Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Reopened to Closed

You're right, thanks!

Actions #57

Updated by Marius BĂLTEANU over 5 years ago

Oh, sorry, I've missed to update the translation for en-GB.yml in my previous patch (source:trunk/config/locales/en-GB.yml#L1263).

Actions #58

Updated by Marius BĂLTEANU over 5 years ago

  • Status changed from Closed to Reopened

Please commit the below change:

vagrant@jessie:/vagrant/project/redmine$ git diff
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index 00db732..5cd0e14 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -1260,6 +1260,5 @@ en-GB:
   error_spent_on_future_date: Cannot log time on a future date
   setting_timelog_accept_future_dates: Accept time logs on future dates
   label_delete_link_to_subtask: Delete relation
-  error_not_allowed_to_log_time_for_other_users: Your role is not allowed to log time
-    for other users
+  error_not_allowed_to_log_time_for_other_users: You are not allowed to log time for other users
   permission_log_time_for_other_users: Log spent time for other users
Actions #59

Updated by Jean-Philippe Lang about 5 years ago

  • Status changed from Reopened to Closed

Done.

Actions #60

Updated by Go MAEDA over 4 years ago

  • Related to Patch #32196: Allow import time entries for other users added
Actions #61

Updated by Marius BĂLTEANU about 4 years ago

  • Related to Defect #32774: Creating time tracking entry for other user through rest API fails with 403 added
Actions #62

Updated by Go MAEDA about 4 years ago

  • Related to Defect #32959: Fix selected user on log time edit page when user has permissions to log time for another user added
Actions #63

Updated by Marius BĂLTEANU about 4 years ago

  • Related to Defect #32973: Editing a time entry for a locked user changes the user to the current user added
Actions #64

Updated by Go MAEDA about 4 years ago

  • Has duplicate Feature #3800: Editing time entries should show the person involved added
Actions #65

Updated by Marius BĂLTEANU about 4 years ago

  • Has duplicate deleted (Feature #3800: Editing time entries should show the person involved)
Actions #66

Updated by Marius BĂLTEANU about 4 years ago

  • Related to Feature #3800: Editing time entries should show the person involved added
Actions #67

Updated by Meindert Oldenburger about 2 years ago

Hello, thanks for the good work.

Is there a patch that I can apply on redmine 4.0.7? I can't upgrade because of redmine debian multiple instances solution we use.

Actions

Also available in: Atom PDF