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
milestone: limbo --> forge-backlog
Description has changed:
Diff:
created #146: [#4637] Create URL shortener Allura App (4cp)
Related
Tickets:
#4637Closed #146. Branch 42cc_4637.
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:
#4785The
ShortUrl
model should inherit fromArtifact
and add anindex
method, so that the URLs are searchable. Additionally, this ties the model to the project via the AppConfig instance, so theproject_id
field is unnecessary (using instead theapp_config_id
andapp
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 abrowse
permission that controls whether the app shows up in the navigation bar by way of the app implementing theis_visible_to
method (seeAllura/allura/ext/admin/admin_main.py
line 69). By default, only Admins should be able to browse the URLs.Created #168: [#4637] URL shortener Allura App improvements (1cp)
Related
Tickets:
#4637Closed #168. All changes in branch 42cc_4637.
I made some corrections to the private flag and search, but otherwise good.
Discovered some more items that need to be addressed:
ShortURLAdminController.add()
doesn't enforceCREATE
/UPDATE
permissions, allowing anyone to add or modify URLs if they can construct the POST request without the UI.Should probably add Update / Remove links to the table.
Please note that I made some changes as well, so you'll need to rebase from dev.
Created #176: [#4637] URL shortener improvements (2cp)
Related
Tickets:
#4637Closed #176. Changes are in branch 42cc_4637a.