Skip to content

Commit

Permalink
updates some TODOs and controller refs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Aug 21, 2015
1 parent 1dd4f82 commit dec3c3c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 52 deletions.
7 changes: 5 additions & 2 deletions Development-Guidelines/index.md
Expand Up @@ -11,8 +11,11 @@ How the Visual Studio solution is put together, what the funtionality of each pr
##[Working with the code](working-with-code.md)
Describes the process of creating new classes and where they should be stored in regards to namespaces and projects. Also describes how to deal with updating legacy code and how it should be updated.

##[Unit testing](unit-testing.md)
Describes how to write unit testable code and how to write unit tests for the code in Umbraco.
##Unit testing

There are plenty of unit tests in the core of Umbraco both for c# found in Umbraco.Tests project and for JS found in the Umbraco.Web.UI.Client project.

When submitting pull requests or working with the code we encourage all developers to make changes by writing unit tests, a PR will have a far higher chance of being pulled into the core quicker with passing unit tests.

##[Breaking changes](breaking-changes.md)
Defines what a breaking change is in regards to the Umbraco core codebase and describes how to deal with required breaking changes.
6 changes: 2 additions & 4 deletions Development-Guidelines/project-structure.md
Expand Up @@ -8,7 +8,7 @@ The goal of the Umbraco project is to be able to be left with only a few Visual
* Umbraco.Core
* Umbraco.Web
* Umbraco.Web.UI
* [Umbraco.Web.UI.Client](umbraco-web.ui-client.md) (**v7+ only**)
* [Umbraco.Web.UI.Client](umbraco-web.ui-client.md)
* Umbraco.Tests

Achieving this goal will take quite a lot of time by slowly migrating over old code and refactoring it into new code under new namespaces and projects. This cannot all happen at the same time but starting down this path now means that we can realize this goal sooner.
Expand All @@ -29,7 +29,7 @@ Achieving this goal will take quite a lot of time by slowly migrating over old c
* Legacy webforms files have their codebehind files in the Umbraco.Web project. If these legacy webforms files need to be worked on, we can migrate their codebehind files to the Umbraco.Web.UI project as we see fit.
* **ALL NEW ASPX, ASCX, ASMX and any other webforms file that requires a codebehind will exist under the Umbraco.Web.UI project**
* **MORE IMPORTANT -> BECAUSE THE NAMES OF THE FOLDERS ARE NOT PROPER CASE YOU WILL NEED TO ENSURE THAT THE NAMESPACE IS OF THE CORRECT CASE. SO WHEN YOU CREATE YOUR ASPX PAGE, THE NAMESPACE NAME MIGHT BE: *Umbraco.Web.UI.umbraco.settings* . YOU NEED TO CHANGE THIS TO: *Umbraco.Web.UI.Umbraco.Settings***
* Umbraco.Web.UI.Client (**v7+ only**)
* Umbraco.Web.UI.Client
* [See here for the sub-structure details of this project](umbraco-web.ui-client.md)
* Contains all of the files used to create the v7 AngularJs back office application
* This project is part of the solution as a simple 'website', it does not compile
Expand All @@ -42,8 +42,6 @@ Achieving this goal will take quite a lot of time by slowly migrating over old c

_The code in the legacy projects will eventually be migrated and refactored with correct naming and code conventions into the new projects and namespaces_

**TODO: Documentation to be completed**

* SqlCE4Umbraco
* umbraco.businesslogic
* umbraco.cms
Expand Down
12 changes: 0 additions & 12 deletions Development-Guidelines/unit-testing.md

This file was deleted.

10 changes: 5 additions & 5 deletions Implementation/Controllers/index.md
Expand Up @@ -60,11 +60,11 @@ You can attribute your controller or action with this attribute which will ensur
[MemberAuthorize]
public class AccountController : SurfaceController
{
[HttpPost]
public ActionResult UpdateAccountInfo(AccountInfo accountInfo)
{
//TODO: Update the account info for the current member
}
[HttpPost]
public ActionResult UpdateAccountInfo(AccountInfo accountInfo)
{
//TODO: Update the account info for the current member
}
}
```

Expand Down
7 changes: 6 additions & 1 deletion Reference/Routing/Authorized/index.md
Expand Up @@ -8,7 +8,12 @@ will be authenticated. If you have a controller that is not routed within the pr

You do not have to worry about routing if you are using WebApi and using `Umbraco.Web.WebApi.UmbracoAuthorizedApiController` (or any inherited controller) since these are auto routed. All implementations of `UmbracoAuthorizedApiController` (which includes `UmbracoAuthorizedJsonController`) are auto-routed with the default route:

* `/umbraco/backoffice/api/{controller}/{action}`
* `/umbraco/backoffice/api/{controller}/{action}`

In the case that an Umbraco Api Controller is a 'Plugin Controller', then the route would be:

* `/umbraco/backoffice/api/{pluginname}/{controller}/{action}`


##MVC controllers for the back office

Expand Down
31 changes: 4 additions & 27 deletions Reference/Routing/WebApi/index.md
Expand Up @@ -87,36 +87,13 @@ Now this controller will be routed via the area called "AwesomeProducts". All pl

For more information about areas, Urls and routing see the [routing section](routing.md)

###Securing your API methods
API methods can be secured so that only members logged into your site can use them, you can do this using the `Umbraco.Web.WebApi.MemberAuthorize` attribute.

This attribute allows for the following protections to be set up:

- AlowAll: boolean (true by default)
- AllowType: list of allowed member types
- AllowGroup: list of allowed member groups
- AllowMembers: list of allowed members (login names)

`AllowAll` is only there for backwards compatibility, if any of the other "Allow" properties are set then AllowAll is set to false.

Example:

[MemberAuthorize(AllowGroup = "Accounts,Editors")]
public class ProductsController : UmbracoApiController
{
public IEnumerable<string> GetAllProducts()
{
return new[] { "Table", "Chair", "Desk", "Computer", "Beer fridge" };
}
}

When a member is logged in and is member of the member group "Accounts" or "Editors", they will get the result of the API call as normal. Anybody else will get an error telling them they're not allowed to call this method.

Any methods added to this class will have the same protection but you can also add the attribute to a single or a few of your methods when not all methods in your API Controller class need to have the same authorization.

##Backoffice controllers

If you are creating a controller to work within the Umbraco back office then you will need to ensure that it is secured properly by inheriting from: `UmbracoAuthorizedJsonController`. This controller type will auto-route your controller like the above examples except that it will add another Uri path: 'backoffice'. For example:

*~/Umbraco/backoffice/Api/[YourControllerName]*
*~/Umbraco/backoffice/[YourAreaName]/[YourControllerName]*

### More Information

* [Authenticating & Authorizing controllers](../Authorized/index.md)
2 changes: 1 addition & 1 deletion Reference/Routing/custom-routes.md
Expand Up @@ -16,4 +16,4 @@ This is an advanced technique that some devs may be interested in. This post wil

See: [http://shazwazza.com/post/custom-mvc-routes-within-the-umbraco-pipeline/](http://shazwazza.com/post/custom-mvc-routes-within-the-umbraco-pipeline/)

TODO: Write these docs
TODO: Write these docs (https://github.com/umbraco/Umbraco4Docs/issues/200)

0 comments on commit dec3c3c

Please sign in to comment.