←Select platform

AnnGroupsRoles Class

Summary

Provides support for user roles in the annotations framework.

Syntax

C#
VB
WinRT C#
public class AnnGroupsRoles
Public Class AnnGroupsRoles
public sealed class AnnGroupsRoles
function Leadtools.Annotations.Core.AnnGroupsRoles()

Remarks

AnnGroupsRoles supports adding roles for a multi-user application support in the annotations framework. This is accomplished by the following concepts:

  • Operations: This defines the annotations operations to allow or deny. Such as creating or deleting new annotation objects. The AnnOperationType enumeration contain a list of all the operations that can be controlled using this system. Each operation belong to a role, such as a view or an edit operation. Operations can also controlled individually if such fine tuning is required.

  • Roles: This defines common roles such as a view only or view and edit. AnnRoles defines the list of roles used by the application.

  • Groups: This defines the group (or memberships) that have access to a role such as an Admin, a Guest or any other custom group. This is accomplished through the GroupRoles dictionary which define the group (as the key) and the roles that belong to it (as a collection of roles).

  • Users: Finally, this defines the individual users of the system. Each user must belong to a group. This is accomplished through the GroupUsers dictionary which defines a group (as the key) and the users that belong to it (as a collection of user names).

The AnnotationsRolesDemo projects contains a of multi-user annotations application. Refer to the source code of the demo for a full example.

To create a multi-user application:

  1. Create an instance of AnnGroupsRoles

  2. Define the roles required by creating an instance of AnnRoles. AnnRoles contain common roles that can be used as is such as AnnRoles.ViewAll, AnnRoles.EditAll and AnnRoles.FullControl to be able to view/edit and have full control over all annotation objects for all users. And AnnRoles.View and AnnRoles.Edit to be able to view and edit only the annotation objects created by the specified user.

  3. Define the groups required by the application. This is a list of names of the groups such as "Admin" and "Guest" and any other group defined by the application. Assign roles to each group by adding values to the GroupRoles dictionary.

  4. Define the users of the application. Each user must belong to a group, so add all the user names to the GroupUsers dictionary.

  5. Set the current logged in user to CurrentUser.

  6. Set the AnnGroupsRoles object created into the all the AnnContainer objects in the application.

When the application runs and the various annotations operations are invoked on this container, the system will map the CurrentUser to its group to deduce the roles. Then it will check if the group contains the correct role before allowing or denying the operation.

The annotation framework will accomplish this by calling the IsUserInRole method with the user name and an AnnOperationInfoEventArgs instance that contains default details of the operation (for instance, the user is deleting an object). The default mapping of the operation versus the role (deleting an object is an Edit operation) will be invoked and the method will return a boolean value to the caller annotation method to continue or abort the operation.

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Annotations.Core Assembly
Click or drag to resize