Skip to content

Samples Overview

Eyedia edited this page Dec 5, 2017 · 2 revisions

Getting started with sample

  1. Create a console Application.
  2. Get aarbac from nuget.
  3. The package will also contain:
    1. books.mdf - A sample "Books" application database with some valid data in it. Assume this as your own application and you want to provide row,column level permission along with user interface entitlements.
      Books DB Model
    2. rbac.mdf - The rbac database with 20 users and 3 roles of "Books" application preloaded.
      1. role_city_mgr See test result. Role highlights:
        1. Cannot see SSN of Author.
        2. Can see records from 2 cities, the role expects 1 user parameter as '{CityNames} with comma separated city names, and user 'Lashawn' is configured with 'Charlotte' & 'New York' cities.
        3. Can update Name of Author table.
        4. Cannot update SSN of Author.
        5. Can insert into book.
        6. Cannot delete anything.
      2. role_country_mgr
      3. role_state_mgr
    3. test.txt - One sample query of "Books" application.
    4. test.csv - Few sample queries(select, insert, update, delete) of "Books" application.
    5. AarbacSamples.cs - Sample code, thanks to nuget, which will automatically add the .cs file into your project. Just type:
new AarbacSamples().BookStoreTestOne();
Console.Read();

Above code will test a query from test.txt. This will ensure everything is good, the .mdf files are attached correctly. Check out the test_result.txt (the output) along with test.txt (the input). In case of any connectivity issue, just troubleshoot as you regularly do. Alternatively you can attach the .mdfs manually into SQL Server instance and change the connection string in the config file.

Interesting?! Try this out then...

new AarbacSamples().BookStoreTestBatch();
Console.Read();

This will parse all queries from test.csv and store parsed queries into test_result.csv. Study all the input queries and parsed queries to get feel of aarbac framework. See the test result.

Clone this wiki locally