示例#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));
        }
示例#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);
        }
示例#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));
        }
示例#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);
        }
示例#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));
        }
示例#6
0
 internal static void SetMailTipsAccessScope(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessScope <MailTipsAccessLevel>(value as ADObjectId, properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None);
 }
示例#7
0
 internal static object GetMailTipsAccessScope(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.MailTipsAccessLevel:", OrganizationRelationshipNonAdProperties.MailTipsAccessScopeScopeCache));
 }
示例#8
0
 internal static void SetMailTipsAccessLevel(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessLevel <MailTipsAccessLevel>((MailTipsAccessLevel)value, properties, "MSExchange.MailTipsAccessLevel:");
 }
示例#9
0
 internal static object GetMailTipsAccessLevel(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessLevel <MailTipsAccessLevel>(properties, "MSExchange.MailTipsAccessLevel:", MailTipsAccessLevel.None));
 }
示例#10
0
 internal static void SetFreeBusyAccessScope(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessScope <FreeBusyAccessLevel>(value as ADObjectId, properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None);
 }
示例#11
0
 internal static object GetFreeBusyAccessScope(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessScope(properties, "MSExchange.SharingCalendarFreeBusyLevel:", OrganizationRelationshipNonAdProperties.FreeBusyAccessScopeCache));
 }
示例#12
0
 internal static void SetFreeBusyAccessLevel(object value, IPropertyBag properties)
 {
     OrganizationRelationshipHelper.SetAccessLevel <FreeBusyAccessLevel>((FreeBusyAccessLevel)value, properties, "MSExchange.SharingCalendarFreeBusyLevel:");
 }
示例#13
0
 internal static object GetFreeBusyAccessLevel(IPropertyBag properties)
 {
     return(OrganizationRelationshipHelper.GetAccessLevel <FreeBusyAccessLevel>(properties, "MSExchange.SharingCalendarFreeBusyLevel:", FreeBusyAccessLevel.None));
 }