Menu

#19 Adding Roles to BugTracker.NET (CODE ATTACHED)

open
nobody
None
5
2009-11-05
2007-10-04
Jimmy M
No

i didn't see a way to attach this to any of the existing roles posts - so I made a new one.

Attached is my take on the many roles feature requests seen on the features list.

Some new role-related files, and some updates to editing bugs, users, etc.

Run the sqlupdate.sql script on your bugtracker.net DB (back it up first :) to create/alter the appropriate DB tables.

A summary of features:

1) Admin menu now has roles option. Roles can be added and specific statuses can be selected to apply to those roles.

2) Editing a user a default role can be assigned to that user.

3) User project permissions can also have roles set on a per-project basis. This can be done from the admin's 'edit user' screen, or the project's 'edit user permissions' screen

4) Added 'role' column to user list in admin section.

When creating or editing bugs, only the statuses you have access to (either by default, or inside that project) can be selected. Should a user have created a bug with a status you don't have access to - but it's assigned to you - the option of '[current status]' is selected by default. This allows you to make changes to the bug without having to set it to a status you have access to that may not be appropriate (i.e. a PM assigns a bug to a sales person for more info, but that bug is 'in process' and sales people only have access to the statuses of 'new' and 'on hold' - the sales person can answer the question and give it back to someone without changing status).

The SQL script will also create an 'Admin' role, give it access to all statuses, and assign it to every user. This is so your btnet install does not break because users must be assigned a role. This will give them the same functionality they have now (the ability to assign all statuses) and then you can create alternate roles and assign them to users.

Enjoy :)

Discussion

  • Jimmy M

    Jimmy M - 2007-10-04

    Logged In: YES
    user_id=1905598
    Originator: YES

    File Added: Bugtracker-Roles.zip

     
  • Corey Trager

    Corey Trager - 2007-10-05
    • priority: 5 --> 9
     
  • Corey Trager

    Corey Trager - 2007-10-05

    Logged In: YES
    user_id=645778
    Originator: NO

    Thanks for posting this. Just from your description, its sounds like a lot of work and a major, important change.

    Folks - if anybody else tries these changes out, please post your experience here. Thanks.

     
  • Nobody/Anonymous

    Logged In: NO

    ctrager - did you try it out?

     
  • Jimmy M

    Jimmy M - 2007-10-05

    Logged In: YES
    user_id=1905598
    Originator: YES

    v--- forgot to log in ---V

     
  • Corey Trager

    Corey Trager - 2007-10-05

    Logged In: YES
    user_id=645778
    Originator: NO

    it will be a couple weeks probably before I have a block of time to try it out.

     
  • Jimmy M

    Jimmy M - 2007-10-05
     Code for adding Roles to BugTracker.NET (merge with v2.5.6) (new 10/5)
    
     
  • Jimmy M

    Jimmy M - 2007-10-05

    Logged In: YES
    user_id=1905598
    Originator: YES

    File Added: Bugtracker-Roles.zip

     
  • Jimmy M

    Jimmy M - 2007-10-05

    Logged In: YES
    user_id=1905598
    Originator: YES

    Please download the latest version if you haven't. Had a bug in edit_bug.aspx on new bug creation that didn't save the initial status.

     
  • Nobody/Anonymous

    Logged In: NO

    3 errors found in SQL script make me want to wait until this is officially integrated:

    -- 1. Need to add the DEFAULT(1) with the NOT NULL or better yet change to NULL
    ALTER TABLE project_user_xref ADD pu_default_role int NOT NULL DEFAULT(1)
    GO
    -- 2. ditto
    ALTER TABLE users ADD us_default_role int NOT NULL DEFAULT(1)
    GO
    -- 3. The insert statement for role_status_xref had mutliple bugs. This is what it should be:

    INSERT INTO role_status_xref
    (rs_statusid, rs_roleid)
    SELECT st_id, r_id
    FROM roles, statuses
    GO

    I will post results if/when I get time to play with this.

     
  • Jimmy M

    Jimmy M - 2007-10-08

    Logged In: YES
    user_id=1905598
    Originator: YES

    Thanks for the comments. The defaults and 'not null's are not required - I'll explain:

    #1 - this is checked for in the code - null in the pu_default_role means use the user's default role.

    #2 - users do not need a default role assigned. The SQL script creates the initial role and assigns them to it - and subsequent user adds require a selection from the role dropdown (there is no blank/null option). You could set it to not null, but there's not really a point.

    #3 - Thanks for the cleanup on that, I had originally intended it to read:

    INSERT INTO role_status_xref
    SELECT st_id AS rs_statusid, r_name AS rs_roleid
    FROM roles, statuses

    but yours accomplishes the same goal.

    Thanks for the comments!

     
  • Corey Trager

    Corey Trager - 2007-10-27

    Logged In: YES
    user_id=645778
    Originator: NO

    I haven't forgotten about this, but I've been working on other items....

     
  • Corey Trager

    Corey Trager - 2007-11-01
    • assigned_to: nobody --> ctrager
     
  • Corey Trager

    Corey Trager - 2008-03-16

    Logged In: YES
    user_id=645778
    Originator: NO

    The BugTracker.NET codebase has moved on and is no longer compatible with the changes here. The current codebase (2.8.1) sort of accomplishes the same things, in general, that the changes here were intended to do. See "organizations" and workflow.cs in 2.8.1

     
  • Corey Trager

    Corey Trager - 2008-03-16
    • priority: 9 --> 5
     
  • Corey Trager

    Corey Trager - 2008-10-25
    • priority: 5 --> 2
     
  • Corey Trager

    Corey Trager - 2009-11-05
    • assigned_to: ctrager --> nobody
     
  • Corey Trager

    Corey Trager - 2009-11-05
    • priority: 2 --> 5