One of the main advantages using Coast is that it support roles in a highly flexible manner. This let you define exactly which user may access which pages. Because Coast also provides a session mechanism the user can login once and all his privileges are granted from then on.
[[#wd DisplayAnythingRenderer { /AnythingInfo { "/Roles {" " /Role {" " "Default"" " }" "}" " " "or another one" " " "/Roles {" " /Role { "Admin" "Guest" "Customer" }" " /Guest { "Default" }" "}" } }]]All the Roles must be defined there. You may also specify a Default role but this is not implemented properly by now.
[[#wd DisplayAnythingRenderer { /AnythingInfo { "/RoleChanges {" " /GoAdmin "Admin"" " /GoCustomer "Customer"" "}" } }]]This defines actions that forces the role to be changed (Use a overwritten 'DoAction' to launch the appropriate Action - see [[#wd Lookup Recipe9 ]] )..
[[#wd DisplayAnythingRenderer { /AnythingInfo { "/GuestRole 0" "/CustomerRole 1" "/AdminRole 2" } }]]This defines the hierarchy AdminRole > CustomerRole > GuestRole.
[[#wd DisplayAnythingRenderer { /AnythingInfo { "MyNewRole::MyNewRole() : Role("MyNewRole")" "{}" } }]]There are three interesting methods more which may be overwritten. They allow you to implement specific security checks.
[[#wd DisplayAnythingRenderer { /AnythingInfo { "// Resolve the name for the next page with currentpage and action." "// The default implementation uses a table driven" "// approach. The table is usually defined in [RoleName].any" " " "virtual bool DoGetNewPageName( Context &c, String &transition, String& pagename );" " " "// checks role levels by name according to role precedence defined in Role.any" "// GuestRole < CustomerRole < AnotherRole" " " "virtual bool CheckLevel(const char *name) const;" " " "// verifies query params default implementation" "// does nothing" "virtual bool DoVerify(Context &,String &,String &);" } }]]
Navigation Map, Role concept