locked
How to list permitted data types for child application RRS feed

  • Question

  • Thanks to an earlier post I understand that the only was to currently create a child application is via the SDK.  In addition, the master application defines the "datatype ceiling" for the child applications it creates.  I intend to build a tool that creates child applications and would like the user(s) of that tool to define what datatypes the child application(s) need access.

    My question:

    Is it possible to list the available datatypes to which the master application has defined as the data type ceiling?

    Tuesday, September 28, 2010 7:06 PM

Answers

  • The following code should work for you. You can get the list of auth rules for the application, and from there, you can get the types:

     

    ApplicationInfo applicationInfo = __connection.GetApplicationInfo();

                    // You may need to use OnlineBaseAuthorizations in the below
                    IList<AuthorizationRule> authRules = applicationInfo.OfflineBaseAuthorizations;  

                    foreach (AuthorizationRule authRule in authRules)
                    {
                        List<string> authSetDefinitionXmls = new List<string>();
                        foreach (TypeIdSetDefinition typeIdDefinition in authRule.TargetSets)
                        {
                            string typeId = typeIdDefinition.TypeId.ToString();
                            // store typeid
                        }
                    }

    • Marked as answer by rsknowles Thursday, September 30, 2010 4:45 PM
    Wednesday, September 29, 2010 4:27 AM

All replies

  • You should be able to do this, though I haven't tested this particular scenario...

    First, you would need to fetch the list of all the data types. You can do this by fetching the "thing-types" vocabulary (using Connection.GetVocabulary()), which will give you a list of the data type guids as the keys, and the name of the data types as the display values.

    Then, you can figure out whether an application has a access to a datatype with the code described here, and passing in each of the data type guids.

    I'm not sure how fast this is going to be, however - it may take a bit of time for a lot of data types, so you may need to cache the result you get back.

     

    Tuesday, September 28, 2010 10:24 PM
  • The following code should work for you. You can get the list of auth rules for the application, and from there, you can get the types:

     

    ApplicationInfo applicationInfo = __connection.GetApplicationInfo();

                    // You may need to use OnlineBaseAuthorizations in the below
                    IList<AuthorizationRule> authRules = applicationInfo.OfflineBaseAuthorizations;  

                    foreach (AuthorizationRule authRule in authRules)
                    {
                        List<string> authSetDefinitionXmls = new List<string>();
                        foreach (TypeIdSetDefinition typeIdDefinition in authRule.TargetSets)
                        {
                            string typeId = typeIdDefinition.TypeId.ToString();
                            // store typeid
                        }
                    }

    • Marked as answer by rsknowles Thursday, September 30, 2010 4:45 PM
    Wednesday, September 29, 2010 4:27 AM