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 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);
        }
Example #3
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));
        }
Example #4
0
        private static string GetAndRemoveAction(MultiValuedProperty <string> actions, string prefix)
        {
            string action = OrganizationRelationshipHelper.GetAction(actions, prefix);

            if (action != null)
            {
                actions.Remove(action);
            }
            return(action);
        }
Example #5
0
        private static void SetAccessScope <T>(ADObjectId objectId, IPropertyBag properties, string prefix, T defaultLevel)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string target          = (objectId != null) ? objectId.ObjectGuid.ToString() : null;
            string andRemoveAction = OrganizationRelationshipHelper.GetAndRemoveAction(multiValuedProperty, prefix);
            string text            = OrganizationRelationshipHelper.GetLevelElement(andRemoveAction);

            if (text == null)
            {
                text = defaultLevel.ToString();
            }
            multiValuedProperty.Add(OrganizationRelationshipHelper.GenerateAction(prefix, text, target));
        }
Example #6
0
 internal static void SetMailTipsAccessScope(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessScope <MailTipsAccessLevel>(value as ADObjectId, properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None);
 }
Example #7
0
 internal static object GetMailTipsAccessScope(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.MailTipsAccessLevel:", OrganizationRelationshipNonAdProperties.MailTipsAccessScopeScopeCache));
 }
Example #8
0
 internal static void SetMailTipsAccessLevel(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessLevel <MailTipsAccessLevel>((MailTipsAccessLevel)value, properties, "MSExchange.MailTipsAccessLevel:");
 }
Example #9
0
 internal static object GetMailTipsAccessLevel(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessLevel <MailTipsAccessLevel>(properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None));
 }
Example #10
0
 internal static void SetFreeBusyAccessScope(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessScope <FreeBusyAccessLevel>(value as ADObjectId, properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None);
 }
Example #11
0
 internal static object GetFreeBusyAccessScope(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.SharingCalendarFreeBusyLevel:", OrganizationRelationshipNonAdProperties.FreeBusyAccessScopeCache));
 }
Example #12
0
 internal static void SetFreeBusyAccessLevel(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessLevel <FreeBusyAccessLevel>((FreeBusyAccessLevel)value, properties, "MSExchange.SharingCalendarFreeBusyLevel:");
 }
Example #13
0
 internal static object GetFreeBusyAccessLevel(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessLevel <FreeBusyAccessLevel>(properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None));
 }