#4637 Create URL shortener Allura App

v1.0.0
closed
nobody
42cc (432)
General
Cory Johns
2015-08-20
2012-08-01
Cory Johns
No

Create an Allura Application that stores shortened URLs. The short_name of the URL is given by the user, and the URL can be made either public or private. We will also need a migration script, which will be created in another ticket, to pull existing URL data from a MySQL database.

Example URL (if installed on myproject at mount point url with a URL short_name of 'sshfp'):

  • http://sf.net/p/myproject/url/sshfp

URL Data:

  • url
  • short_name (indexed, unique)
  • description
  • private
  • create_user
  • created
  • last_updated

Permissions (all should default to Admin):

  • CREATE
  • UPDATE
  • VIEW_PRIVATE

App properties:

  • default_mount_point = 'url'
  • installable = False (the tool should not show up in the installable list)
  • hidden = True (the tool should not show up in the navigation bar)
  • sitemap = []

Adding or editing a URL should create an entry in the project audit log that includes the old and new URLs.

The admin menu for the tool should have an Add and Browse option.

Add should present a pop-up with inputs for the short_name, full URL and a checkbox for private.

Browse should open a separate page which lists the URLs for the app. Users without the VIEW_PRIVATE permission should be able to view the page, but shouldn't see the private URLs listed. The page should list the following:

  • private
  • create_user
  • short URL
  • full URL
  • description
  • created
  • last_updated

The Add and Browse pages will need not conflict with user-defined short_names, perhaps by overloading index via query paramaters (e.g., /p/myproject/url/?action=browse). Or /p/myproject/url with no param is used for browsing, and adding is via the admin controller /p/myproject/admin/url/add

Related

Tickets: #4637
Tickets: #4785

Discussion

  • Dave Brondsema

    Dave Brondsema - 2012-08-07
    • milestone: limbo --> forge-backlog

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,8 +1,8 @@
     Create an Allura Application that stores shortened URLs.  The `short_name` of the URL is given by the user, and the URL can be made either public or private.  We will also need a migration script, which will be created in another ticket, to pull existing URL data from a MySQL database.
    
    -**Example URL** (if installed on `/p/` neighborhood with a `short_name` of `'sshfp'`):
    +**Example URL** (if installed on `myproject` at mount point `url` with a URL `short_name` of `'sshfp'`):
    
    -* `http://sf.net/p/url/sshfp`
    +* `http://sf.net/p/myproject/url/sshfp`
    
     **URL Data:**
    
    @@ -43,4 +43,4 @@
     * `created`
     * `last_updated`
    
    -The `Add` and `Browse` pages will need not conflict with user-defined short_names, perhaps by overloading `index` via query paramaters (e.g., `/p/url/?action=browse`).
    +The `Add` and `Browse` pages will need not conflict with user-defined short_names, perhaps by overloading `index` via query paramaters (e.g., `/p/myproject/url/?action=browse`).  Or `/p/myproject/url` with no param is used for browsing, and adding is via the admin controller `/p/myproject/admin/url/add`
    
     
  • Dave Brondsema

    Dave Brondsema - 2012-08-08
    • labels: --> 42cc
     
  • Yaroslav Luzin - 2012-08-10
    • status: open --> in-progress
     
  • Yaroslav Luzin - 2012-08-10

    created #146: [#4637] Create URL shortener Allura App (4cp)

     

    Related

    Tickets: #4637

  • Igor Bondarenko - 2012-09-05

    Closed #146. Branch 42cc_4637.

    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2012-09-05
    • qa: Cory Johns
     
  • Igor Bondarenko - 2012-09-07

    I've been working on [#4785] and made some fixes to ShortUrl model that related to this ticket, so I updated the code in branch 42cc_4637 with those fixes (commit b6270002882d58bbb34b33850a6c11a1a4083843)

     

    Related

    Tickets: #4785

  • Cory Johns - 2012-09-11
    • status: code-review --> open
     
  • Cory Johns - 2012-09-11

    The ShortUrl model should inherit from Artifact and add an index method, so that the URLs are searchable. Additionally, this ties the model to the project via the AppConfig instance, so the project_id field is unnecessary (using instead the app_config_id and app properties). Also, uninstalling the app should remove the URLs data for that app instance.

    Also, I was mistaken about how the hidden field works, as it appears to only hide the tool from the list of installed tools on the Admin page, preventing access to the permissions and other configuration. What we actually need is a browse permission that controls whether the app shows up in the navigation bar by way of the app implementing the is_visible_to method (see Allura/allura/ext/admin/admin_main.py line 69). By default, only Admins should be able to browse the URLs.

     
  • Igor Bondarenko - 2012-09-12

    Created #168: [#4637] URL shortener Allura App improvements (1cp)

    • status: open --> in-progress
     

    Related

    Tickets: #4637

  • Igor Bondarenko - 2012-09-19

    Closed #168. All changes in branch 42cc_4637.

    • status: in-progress --> code-review
     
  • Cory Johns - 2012-09-24
    • status: code-review --> closed
    • milestone: forge-backlog --> forge-oct-05
     
  • Cory Johns - 2012-09-24

    I made some corrections to the private flag and search, but otherwise good.

     
  • Cory Johns - 2012-09-24
    • status: closed --> open
    • milestone: forge-oct-05 --> forge-backlog
     
  • Cory Johns - 2012-09-24

    Discovered some more items that need to be addressed:

    • ShortURLAdminController.add() doesn't enforce CREATE/UPDATE permissions, allowing anyone to add or modify URLs if they can construct the POST request without the UI.
    • Update needs to be separated from add, and add should not overwrite existing URLs without warning or confirmation
    • Need remove functionality

    Should probably add Update / Remove links to the table.

     
  • Cory Johns - 2012-09-24

    Please note that I made some changes as well, so you'll need to rebase from dev.

     
  • Igor Bondarenko - 2012-09-25

    Created #176: [#4637] URL shortener improvements (2cp)

    • status: open --> in-progress
     

    Related

    Tickets: #4637

  • Igor Bondarenko - 2012-09-27

    Closed #176. Changes are in branch 42cc_4637a.

    • status: in-progress --> code-review
     
  • Cory Johns - 2012-09-27
    • status: code-review --> closed
    • milestone: forge-backlog --> forge-oct-05
     

Log in to post a comment.