416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
This is the support page for the legacy Dundas Dashboard application. For assistance with the current Dundas BI application please click here.
Dashboard v5.0

This site makes extensive use of JavaScript.

Please enable JavaScript in your web browser and reload the page before proceeding.

Creating Custom Accounts and Groups Providers

Hide navigation
RSS
Modified on Wed, 16 Apr 2014 03:53 PM

Requirements


Overview

One of the biggest benefits of &dw; is its extensible API that allows you to do anything from creating your own controls to exporting plugins.

But by far one of the most convenient and extensible features available is the one that allows you to leverage your organization's security infrastructure for accounts and groups management.

For example, you have a database in your company that contains a list of users and perhaps a list of groups that these users belong to. What if you could allow &dw; to tap into this database to authenticate the users so that they can log in to &dw; without having to re-create each account inside &dw;?

Well, this is exactly what the Accounts and Groups services provider lets you do. It lets you create a bridge between &dw; and your own accounts/groups, allowing you to manage the accounts and groups through your own security infrastructure and have &dw; simply consume these to authenticate against.

Workflow

As shown in the figure below, a typical &dw; environment will use the Standard Authentication approach which involves Creating, Reading, Updating, Deleting (CRUD) accounts and groups directly into the application database (the datastore).

Whereas with the custom accounts and groups provider, the CRUD requests are sent to your implementation so that you can perform the required operation in your own environment and then allow &dw; to simply retrieve what you've performed.

The implementation is handled via a .NET class library which is loaded by &dw; so that the CRUD operations are handled by the library instead of &dw;.

It will be up to the library to implement methods required by &dw; to perform CRUD activity for both accounts and groups (depending on what you implement). Having the CRUD operations now being managed in your own code, you can choose to exclude certain operations from being performed, such as preventing deletion of accounts/groups from within &dw;

Provider workflow - standard vs custom.

Provider workflow - standard vs custom.


How to use the sample project

Included in the Downloads tab is a Visual Studio 2012 solution that implements both an Account and Groups provider in a single .NET 3.5 Class Library. Upgrade the solution accordingly if you are using Visual Studio 2010 (or higher).

The sample also uses Microsoft SQL to store the accounts and groups and handles the read/writes via LINQ-to-SQL but can be modified to handle any database engine.

Once you have extracted the sample to a folder (⪚ C:\Projects\), use the steps below to build the sample and test it in your development environment.

Note: The sample is built using version 4.0.1 Rev 4 of &dw;, for earlier versions select the right version from the "Other Versions" menu at the top of this page.

Step 1 - Create the Accounts and Groups database

The sample in this article uses the data-model shown below to create the object model inside the Visual Studio project.

Object Data Model for tables in the database.

Object Data Model for tables in the database.


  • Open SQL Management Studio and connect to your SQL Server.
  • Open and run the SampleDatabase.sql file to restore the sample database.
  • The script will create three tables: GroupMembership, Account and Group. Refer to the comments in the script for more information.
  • If you receive any errors you may have to create the tables/triggers manually.

Note: The sample stores passwords in plain-text. You can modify the project (in Step 2) to encrypt the passwords any way you like.

Step 2 - Build the Project

Note: When the project is built, it performs an "iisreset" to reset IIS. You must be running Visual Studio as an Administrator for this to complete.

  • Start Visual Studio and open the solution.
  • Expand the References folder and ensure Dundas.Dashboard.Extensibility.Server is listed. If there are any warnings/errors on the reference, remove the reference and re-add it.
  • Open the file "ConnectionString.txt"in the bin\debug directory, and edit it to match the connection settings of your MsSQL database created in step 1.
  • Build the project and ensure it builds successfully.

Step 3 - Update the Dashboard configuration file

  • Navigate to the \www folder in &dw; installation (⪚ C:\Program Files\Dundas Data Visualization Inc\Dundas Dashboard\{instance}\www\).
  • Open the Dundas.Dashboard.Config file in a text editor.
  • Navigate the file until you see a section with accountServicesProviderFilename and groupServicesProviderFilename.
  • Update the entries to point to the .DLL of your project. See example below:

<key name="accountServicesProviderFilename" value="C:\Projects\AccountsGroupsProvider\bin\Debug\AccountsGroupsProvider.dll"/>
<key name="groupServicesProviderFilename" value="C:\Projects\AccountsGroupsProvider\bin\Debug\AccountsGroupsProvider.dll"/>

Note: You can choose to implement only Accounts or Groups (or both) in which case only enable the proper configuration tag that pertains to the provider you are implementing. The sample uses both hence both tags above reference the same file.

Step 4 - Testing and Next Steps

  • Ensure the previous steps have all been completed successfully.
  • Launch &dw; and log in as admin.
  • Enter the Administration section and verify the User Accounts and Object Security Groups sections are populated with members from the sample database.

Dashboard populated with accounts and groups from sample database.

Dashboard populated with accounts
and groups from sample database.


At this point, with your working sample of accounts and groups, you can try populating the database with users/groups from your own organization and verifying login/security privileges with these accounts.

IAccountServicesProvider Members

The following methods need to be implemented as part of the IAccountServicesProvider. All methods have to be implemented, however not all methods need to actually perform an operation.

For example, to prevent deletion of Accounts, you can simply throw an exception:

/// 
/// Deletes the account.
/// 
public void DeleteAccount(Guid accountId)
{
    throw new NotImplementedException("Deleting of accounts is not permitted from within Dashboard.");
}


IGroupServicesProvider Members

The following methods need to be implemented as part of the IGroupServicesProvider. All methods have to be implemented, however not all methods need to actually perform an operation.

For example, to prevent deletion of Groups, you can simply throw an exception:

/// 
/// Deletes the group by id.
/// 
public void DeleteGroupById(Guid groupId)
{
    throw new NotImplementedException("Deleting of groups is not permitted from within Dashboard.");
}

  • CreateGroup - Creates a new Group. The provider must not allow the group's membership to be recursive.
  • DeleteGroupById - Deletes a Group specified by its ID.
  • GetAllGroups - Retrieves the application's explicitly created Groups.
  • GetGroupById - Retrieves an explicitly created Group specified by its ID.
  • GetGroupByName - Retrieves an explicitly created Group specified by its name.
  • Initialize - Initializes the provider.
  • UpdateGroup - Updates an existing Group. The provider must not allow the group's membership to be recursive.

Debugging the Provider

Visual Studio can be used to debug the provider while it is being used by Dundas Dashboard. To do this, attach Visual Studio to w3wp.exe, the IIS process.

Image

Then Visual Studio can be used to step through the execution of the code. Dundas Dashboard will call all of the methods in the provider mentioned above in the 2 "members" sections.

Related topics


Downloads

About Dundas | Contact Us Follow us on Twitter! | Privacy Statement | Report Site Issues

Copyright © 2009-2014 Dundas Data Visualization, Inc.