You are viewing an earlier version of the admin guide. For the latest version, please visit EmpowerID Admin Guide v7.211.0.0.

Skip to end of banner
Go to start of banner

Create Code-Based Sets

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Code-based Sets are queries that can result in collections of people or collections of other resource types protected by EmpowerID. Each code-based Set requires a Set Runtime, which is a custom implementation of the EmpowerID API that allows C# code to be used to return a collection of EmpowerID object types. You create code-based Sets in Workflow Studio.

This article demonstrates how to create a code-based set by creating one that returns all people with the title of “Helpdesk Technician.”

Create a code-based Set

  1. Log into Workflow Studio.

  2. From Solution Explorer (located to the left of the Workflow Studio IDE), select the Workspace node.

  3. In the Workspace tree, right-click the folder of your choice and select New Extension or Library > Class Library (.NET Framework).

  4. Select the Properties tab located to the right of the C# Editor and click the Supports button (…).

  5. Select SetRuntime and then click OK.

  6. In the toolbar just above the C# Editor, click the Save button.

  7. Name the class something that represents its purpose and click Save.

  8. In the C# Editor, do the following:

    1. Set the base class for the class to ISetRuntime.

    2. Stub a method for the GetResults() method of the TheDotNetFactory.Framework.People.Components.SetCompilation class and add code to the method that does the following:

      • Creates a new instance of the TheDotNetFactory.Framework.People.Components.Person class, using the Find() method to find EmpowerID Person objects with a title of "Helpdesk Technician."

      • Creates a new instance of the TheDotNetFactory.Framework.People.Components.SetCompilation class.

      • Loops through the new instance of the Person class,
        adding each person returned by the Find() method to the new instance of the SetCompilation class, and
        writing the PersonGUID DisplayName of the SetCompilation class to the FriendlyName property for each person.

      • Returns the results of the collection.

        Here is what the code for the class looks like:

        public class HelpDeskTechniciansSetRuntime :ISetRuntime
        {
        	public E.TList<SetCompilation> GetResults()
        	{
        		int totalCount = -1;
        		E.TList<Person> people = Person.Find
        			 ("Title = Helpdesk Technician", 0, int.MaxValue, out totalCount);
        		E.TList<SetCompilation> results = new E.TList<SetCompilation>();
        		foreach (Person p in people)
        		{
        			results.Add(new SetCompilation() 
        			{SystemIdentifier = p.PersonGUID.ToString(),DisplayName = p.FriendlyName});
        		}
        		return results;			 
        	}
        }

  9. Save your changes and close the CS file.

Publish the code-based Set

  1. On the source control tree, double-click the class library file to open it in Visual Studio.
    If this is the first time opening a class library file in this way, you will be prompted to select the default app with which to open the file. Select Visual Studio.

  2. In Visual Studio, build the Set Runtime solution.

    After Visual Studio builds the solution, you should see a .pub file for the project in the WFS > _PublishedItems folder on your local file system. You publish this file to your system to make the Set Runtime available to EmpowerID as a manageable object that can be used in delegation.


  3. Log in to the EmpowerID web application as a user with the appropriate access to run the PublishWorkflowStudioItem workflow and navigate to the URL for the workflow. The URL should be https://YourEmpowerIDWebServer.com/UI/#w/PublishWorkflowStudioItem.

     

  4. Click Choose File, navigate to the _PublishedItems folder and select the pub file for the Set Runtime. 

  5. Click Submit.

Next, create a SetGroup for the Set.

Create a SetGroup for the Set

  1. On the navbar, expand Role Management and select Query-Based Collections (SetGroup).

  2. Select the Actions tab and then select Create a Query-Based Collection (SetGroup).

  3. Enter the following information in the Create Query-Based Collection form:

    • Name – Name of the collection

    • Display Name –  Display name of the collection

    • Description – Description of the collection

    • Is a collection of person objects – Select if the collection contains persons

    • Location –  Creation location

  4. When ready, click Submit and then click OK to close the Operation Execution Summary.

  5. Search for and select the Set Runtime you just published.

  • No labels