Changeset 1053 for trunk


Ignore:
Timestamp:
09/26/09 22:56:53 (3 years ago)
Author:
bogdan2412
Message:

Allow admins to change task owners - closes ticket #374.

Reviewed: http://reviewboard.infoarena.ro/r/93/

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/security.php

    r1036 r1053  
    142142        case 'task-change-open': 
    143143        case 'textblock-change-security': 
     144        case 'task-edit-owner': 
    144145        case 'task-tag': 
    145146        case 'round-tag': 
  • trunk/www/controllers/task.php

    r997 r1053  
    6666    // Tag data 
    6767    $values['tags'] = request('tags', tag_build_list("task", $task_id)); 
    68      
     68 
     69    // Task owner 
     70    if (identity_can('task-edit-owner', $task)) { 
     71        if ($task["user_id"]) { 
     72            $user = user_get_by_id($task["user_id"]); 
     73            log_assert($user, "Task has invalid user_id"); 
     74            $username = $user["username"]; 
     75        } else { 
     76            $username = ""; 
     77        } 
     78        $values["user"] = request("user", $username); 
     79    } 
     80 
    6981    // Validate the monkey. 
    7082    if (request_is_post()) { 
     
    7385        foreach ($fields as $field) { 
    7486            $new_task[$field] = $values[$field]; 
     87        } 
     88 
     89        if (identity_can('task-edit-owner', $task)) { 
     90            if ($values["user"] == "") { 
     91                $new_task["user_id"] = 0; 
     92            } else { 
     93                $user = user_get_by_username($values["user"]); 
     94                if (!$user) { 
     95                    $errors["user"] = "Utilizator inexistent"; 
     96                } else { 
     97                    $new_task["user_id"] = $user["id"]; 
     98                } 
     99            } 
    75100        } 
    76101 
  • trunk/www/views/task_edit.php

    r996 r1053  
    2121        'page_name' => array( 
    2222                'name' => "Pagina cu enuntul", 
    23                 'description' => "Aceasta este pagina la care este trimis utilizatorul ". 
    24                                  "cand da click pe o problema", 
     23                'description' => "Aceasta este pagina la care este trimis ". 
     24                                 "utilizatorul cand da click pe o problema", 
     25                'type' => 'string', 
     26        ), 
     27        'user' => array( 
     28                'name' => "Utilizatorul care adauga problema", 
     29                'description' => "Utilizatorul care are drepturi de editare ". 
     30                                 "asupra problemei. Poate fi lasat gol.", 
    2531                'type' => 'string', 
    2632        ), 
     
    111117        <?= view_form_field_li($form_fields['title'], 'title') ?> 
    112118        <?= view_form_field_li($form_fields['page_name'], 'page_name') ?> 
     119        <?php if (identity_can('task-edit-owner', $task)) { ?> 
     120            <?= view_form_field_li($form_fields['user'], 'user') ?> 
     121        <?php } ?> 
    113122        <?= view_form_field_li($form_fields['author'], 'author') ?> 
    114123        <?= view_form_field_li($form_fields['source'], 'source') ?> 
    115         <?php if (identity_can('task-change-security', $task)) { ?>  
     124        <?php if (identity_can('task-change-security', $task)) { ?> 
    116125           <?= view_form_field_li($form_fields['hidden'], 'hidden') ?> 
    117126        <?php } ?> 
     
    125134// FIXME: Field should be generated from task_get_types() 
    126135?> 
    127     <?php if (identity_can('task-change-open', $task)) { ?>  
     136    <?php if (identity_can('task-change-open', $task)) { ?> 
    128137    <fieldset> 
    129138    <legend>Acces la surse si teste</legend> 
Note: See TracChangeset for help on using the changeset viewer.