Beispiel #1
0
        private static object GetAccessLevel <T>(IPropertyBag properties, string actionPrefix, T defaultLevel)
        {
            MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string action       = OrganizationRelationshipHelper.GetAction(actions, actionPrefix);
            string levelElement = OrganizationRelationshipHelper.GetLevelElement(action);

            if (levelElement == null)
            {
                return(defaultLevel);
            }
            object result;

            try
            {
                result = (T)((object)Enum.Parse(typeof(T), levelElement, true));
            }
            catch (ArgumentNullException)
            {
                result = defaultLevel;
            }
            catch (ArgumentException)
            {
                result = defaultLevel;
            }
            return(result);
        }
Beispiel #2
0
        private static object GetAccessScope(IPropertyBag properties, string prefix, ADPropertyDefinition cacheDefinition)
        {
            MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string action        = OrganizationRelationshipHelper.GetAction(actions, prefix);
            string targetElement = OrganizationRelationshipHelper.GetTargetElement(action);

            if (targetElement == null)
            {
                return(null);
            }
            Guid guid;

            try
            {
                guid = new Guid(targetElement);
            }
            catch (FormatException)
            {
                return(null);
            }
            catch (OverflowException)
            {
                return(null);
            }
            ADObjectId adobjectId = (ADObjectId)properties[cacheDefinition];

            if (adobjectId != null && adobjectId.ObjectGuid == guid)
            {
                return(adobjectId);
            }
            return(new ADObjectId(guid));
        }
Beispiel #3
0
        private static string GetAndRemoveAction(MultiValuedProperty <string> actions, string prefix)
        {
            string action = OrganizationRelationshipHelper.GetAction(actions, prefix);

            if (action != null)
            {
                actions.Remove(action);
            }
            return(action);
        }