I wrote a custom access control function to get more granular permissions for users. Here is patch so that you can set a permission to allow users to view their own timesheet, without letting them access other users timesheets.

Comments

tom friedhof’s picture

StatusFileSize
new1.73 KB

reuploading a patch that will actually apply

tom friedhof’s picture

StatusFileSize
new5.17 KB

Here is another patch against the development version. More access control for viewing your own time on comments and nodes.

tom friedhof’s picture

StatusFileSize
new4.14 KB

Once more with a patch that will actually apply ;-)

tom friedhof’s picture

StatusFileSize
new5.13 KB

Oops forgot some stuff in that last patch

tom friedhof’s picture

StatusFileSize
new5.49 KB

One more time

tom friedhof’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
drclaw’s picture

Thanks for the *many* patches! =P I'll add this in the next commit.

drclaw’s picture

I just read through the patch more carefully. Should the time sheet not just use the new time tracker permissions to decide whether or not you can view other peoples time sheets? It would be strange if you don't have the 'view all time tracker entries' permission, but can still 'view all time sheet entries' don't you think?

tom friedhof’s picture

StatusFileSize
new5.04 KB

Yeah that's a good point, we should get rid of 'view all time sheet entries', and let 'view all time tracker entries' permission supersede that. I'll integrate the perms more so we don't have redundant perms in two different modules, and time_sheet has a dependency on time_tracker so we know that time_tracker perm will always be there.

Here is the patch again removing the redundant perms.

tom friedhof’s picture

StatusFileSize
new5.61 KB

Forgot a access callback, here's the patch again

drclaw’s picture

Status: Needs review » Fixed

This has been committed to the dev version of Time Tracker. Atrium features have also been updated to match the changes (in case anyone reading this is using the atrium features from github)

linitrex’s picture

Category: feature » bug
Status: Fixed » Active

It seems that there is a problem with the open Atrium feature.
I downloaded the dev version of Time Tracker and the Atrium features

time_tracker-6.x-1.x-dev
fuseinteractive-Atrium-Time-Tracker-e1599e2

I ran update.php that changed one of my tables (I was on time_tracker-6.x-1.0-beta1 before that)

I also enabled the new permissions despite I am the administrator of the site. Now I get.

warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'time_sheet_view_access' not found or invalid function name in /home/osinetwo/public_html/pm.osinetwork.org/includes/menu.inc on line 452.

When I enable the Atrium-Time-Tracker.
Atrium-Time-Tracker is not available in the features list as well.

drclaw’s picture

You're getting that error because you don't have the time_sheet module turned on. That was my fault, sorry! I changed the atrium feature to check for the time_sheet module before using that callback function. Try downloading the atrium feature again and let me know if it works.

Secondly, the feature doesn't show up in the features list because it doesn't actually have any 'features'... I guess it's more just a module than a feature. If you look at the module it's just a few theme function overrides and a couple drupal hooks.

Hope this helps!

drclaw’s picture

Status: Active » Fixed

fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jelle_s’s picture

Status: Closed (fixed) » Active

I have the same error with the time_sheet module turned on

edit:
changing

function atrium_time_tracker_menu_alter (&$items) {
  if (module_exists('time_sheet')) {
    $items['time_sheet/%currentuser'] = array(
      'title' => 'Time Sheet',
      'description' => 'My Time Sheet',
      'page callback' => 'time_sheet_page',
      'page arguments' => array(1),
      'access callback' => 'time_sheet_view_access',
      'access arguments' => array(1),
      'type' => MENU_NORMAL_ITEM,
      'menu_name' => 'features',
      'options' => array(
        'attributes' => array(
          'class' => 'time_sheet_link'
        ),
      ),
    );
  }
}

to

function atrium_time_tracker_menu_alter (&$items) {
  if (module_exists('time_sheet')) {
    $items['time_sheet/%currentuser'] = array(
      'title' => 'Time Sheet',
      'description' => 'My Time Sheet',
      'page callback' => 'time_sheet_page',
      'page arguments' => array(1),
      'access arguments' => array('view time sheet entries'),
      'type' => MENU_NORMAL_ITEM,
      'menu_name' => 'features',
      'options' => array(
        'attributes' => array(
          'class' => 'time_sheet_link'
        ),
      ),
    );
  }
}

in atrium_time_tracker_module fixed the problem for me

drclaw’s picture

@Jelle_S

You shouldn't be getting that error. Are you sure you're using the dev version of time_tracker?

drclaw’s picture

Status: Active » Closed (fixed)

I just tested everything on a fresh install of Atrium and it's working fine. Closing this issue again.