Project Description
FunkyRoles allows developers associate application functionality to security roles. Throughout you UI, you can denote sections of code, buttons, links to a module and function. Behinds the screens,
FunckyRoles determines if the current user has access and displays or disable the function.
Why would I need this project
So, you have an application where there are users - users with varying requirements; some need to perform the day-to-day tasks, some that need to Edit or possibly delete information, and of course, the application has administrative tasks. Okay. You developed the application using the ASP.NET Roles tied to your users and you feel good about this.
Now, you have a Customer database maintenance page (well, probably) where you have a button to create, possibly a list where each Customer can be edited and, as many applications have, a delete button. You embed in your code the
InRoles checks for the Create, the Edit, and the Delete. All good and you're happy with you Customer Management page and proudly show your client how the page works. During the demonstration you tell them "Well, your staff with this role can do this and those with this role can do that." Your happy with the demonstration and think to yourself 'my client must be so impressed with this'. But, their not impressed; their actually confused with your demo and how you're telling them how their business processes need to change to how the software is working rather than it conforming to how we operate.
You Client tells you that his Secretary and Front Store staff need to be able to edit the Customers, the Sales Manager can create new Customers and "I should be the only person that can do everything."
In other words, your Client needs to add and/or change the roles and what they can and can't do. Later, your client tells you add a new function to show the outstanding invoices due for a customer. Who will have access to this and how will you define which role(s) can view this information? What if the client needs to allow his Secretary to Create Customers and in the new year be able to view the outstanding invoices?
This is where FunkyRoles can help. Your software has a defined set of functionality. All you need to do is wrap this functionality once and the function-role association is then managed by the users - not pre-determined by the application.
Let's look at an Example:Let's assume our application has two modules, Company and employee. We define the various modules into an enumerated type named
Modulepublic enum Module
{
Company,
Employee
}
Currently, this Module type is the only component that is not database driven (will explain later). Therefore, lets assume that in our
Roles table we have 'Administrator', 'System User', and 'Sales'. In our
Functions table, we have entries defined as 'Create', 'Edit', 'Delete', 'View', and 'ViewDeleted'. More on this in a bit.
As shown below, we can then use the Functions and roles Matrix view to associate which Roles have access to which Functions for the Company Module.

The last piece of the puzzle is to wrap the functions in our source code with a Method named
UserAllowedFor, as shown below:

As you can see, wrapping
functionality within an if (either using Razor in a cshtml file or in your source code) and the UserAllowedFor sets up the application to be configured using the interface via the Function-Role Matrix.
Defining FunctionsThe system have no limit on the number of functions you can define. System Functions are stored in the SystemFunctions Table and are managed as follows:

Similarly,
Defining Roles are managed this was and also has no limits on the number of roles you can define.
