#4056 Refactor neighborhood levels as feature flags NEEDS CMDS RUN: set-neighborhood-features

v1.0.0
closed
sf-2 (994)
General
2015-08-20
2012-04-16
No

We recently added support for neighborhood levels: 'silver', 'gold', 'platinum', None. Features are enabled based on those settings. We should still store the neighborhood level as a name (could be useful for reporting), but refactor the level checks to be feature checks so we can control them with more granularity. There is also an 'allow_private' flag that we should move into the features. Here's what I think a new field could look like:

features: {
    private_projects: true;
    max_projects: 500;
    css: 'custom'; // options: 'none', 'picker', 'custom'
    google_analytics: true;
}

Paster commands are used to change settings and need to be updated too:

    set-neighborhood-level = allura.command:SetNeighborhoodLevelCommand
    set-neighborhood-private = allura.command:SetNeighborhoodPrivateCommand

Related

Tickets: #3970

Discussion

    • status: open --> in-progress
    • assigned_to: Tim Van Steenburgh
     
    • status: in-progress --> open
    • assigned_to: Tim Van Steenburgh --> nobody
     
  • Jenny Steele - 2012-04-18
    • status: open --> in-progress
    • assigned_to: Jenny Steele
     
  • Dave Brondsema

    Dave Brondsema - 2012-04-20
    • size: --> 2
     
  • Jenny Steele - 2012-04-23
    • status: in-progress --> code-review
    • qa: Tim Van Steenburgh
     
  • Jenny Steele - 2012-04-23

    On allura js/4056. To test, change the neighborhood features using the command like:

        allurapaste set-neighborhood-features  /var/local/config/production.ini 4f906cd40ff2d4090a000283 max_projects 500
    

    Make sure that that changes you make are reflected in the UI. Max projects will prevent you from registering more projects than the number you set, private projects can't be created if they're set to false, and depending on the css setting you'll see a free-form css box, css property pickers, or no css option on the neighborhood admin page.

     
    • status: code-review --> in-progress
     
  • I ran

    $ paster set-neighborhood-features production.ini Projects private_projects False
    

    Then clicked the Add Project button and submitted the form with the Private Project checkbox checked. Got a 500, with this in the log:

    File '/home/tvansteenburgh/tvansteenburgh-7044/forge/Allura/allura/controllers/project.py', line 166 in register
      project_name=project_name, private_project=private_project)
    File '/home/tvansteenburgh/tvansteenburgh-7044/forge/Allura/allura/model/neighborhood.py', line 96 in register_project
      self, shortname, project_name, user or getattr(c,'user',None), user_project, private_project, apps)
    File '/home/tvansteenburgh/tvansteenburgh-7044/forge-classic/sfx/sfx_main.py', line 176 in register_project
      neighborhood, shortname, project_name, user, user_project, private_project, apps)
    File '/home/tvansteenburgh/tvansteenburgh-7044/forge/Allura/allura/lib/plugin.py', line 342 in register_project
      raise ValueError("You can't create private projects for %s neighborhood" % neighborhood.name)
    ValueError: You can't create private projects for Projects neighborhood
    
     
  • Dave Brondsema

    Dave Brondsema - 2012-04-24
    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2012-04-24

    That was mostly my fault when QAing the original private projects flag - I didn't ensure that forge-classic's copy of the reg form was updated. I have updated it now in forge-classic:db/4056 using the new field.

     
    • status: code-review --> closed
     
  • Merged forge and forge-classic to dev.

     
  • Dave Brondsema

    Dave Brondsema - 2012-04-26
    • summary: Refactor neighborhood levels as feature flags --> Refactor neighborhood levels as feature flags NEEDS CMDS RUN: set-neighborhood-features
     

Log in to post a comment.