Example #1
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));
        }
Example #2
0
        private static void SetAccessLevel <T>(T accessLevel, IPropertyBag properties, string prefix)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string andRemoveAction = OrganizationRelationshipHelper.GetAndRemoveAction(multiValuedProperty, prefix);
            string targetElement   = OrganizationRelationshipHelper.GetTargetElement(andRemoveAction);

            multiValuedProperty.Add(OrganizationRelationshipHelper.GenerateAction(prefix, accessLevel.ToString(), targetElement));
        }