Ejemplo n.º 1
0
        // Token: 0x06002FDF RID: 12255 RVA: 0x001176A0 File Offset: 0x001158A0
        public static bool UserHasRightToLoad(Folder folder)
        {
            object          obj         = folder.TryGetProperty(StoreObjectSchema.EffectiveRights);
            EffectiveRights valueToTest = (EffectiveRights)obj;

            return(Utilities.IsFlagSet((int)valueToTest, 2));
        }
Ejemplo n.º 2
0
 private static void CheckPermissions(StoreSession session, ICollection <StoreObjectId> ids)
 {
     foreach (StoreObjectId storeObjectId in ids)
     {
         using (Folder folder = Folder.Bind(session, storeObjectId, new PropertyDefinition[]
         {
             InternalSchema.EffectiveRights
         }))
         {
             EffectiveRights valueOrDefault = folder.GetValueOrDefault <EffectiveRights>(InternalSchema.EffectiveRights);
             if ((valueOrDefault & EffectiveRights.Read) == EffectiveRights.None)
             {
                 throw new AccessDeniedException(ServerStrings.UserHasNoEventPermisson(storeObjectId.ToBase64String()));
             }
         }
     }
 }
Ejemplo n.º 3
0
        private static bool HasRight(Item item, EffectiveRights effectiveRightToCheck)
        {
            EffectiveRights property = ItemUtility.GetProperty <EffectiveRights>(item, StoreObjectSchema.EffectiveRights, EffectiveRights.None);

            return((property & effectiveRightToCheck) == effectiveRightToCheck);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="propertyBag">The property bag.</param>
        internal override sealed void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
        {
            EffectiveRights value = EffectiveRights.None;

            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, this.XmlElementName);

            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if (reader.IsStartElement())
                    {
                        switch (reader.LocalName)
                        {
                        case XmlElementNames.CreateAssociated:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.CreateAssociated;
                            }
                            break;

                        case XmlElementNames.CreateContents:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.CreateContents;
                            }
                            break;

                        case XmlElementNames.CreateHierarchy:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.CreateHierarchy;
                            }
                            break;

                        case XmlElementNames.Delete:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.Delete;
                            }
                            break;

                        case XmlElementNames.Modify:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.Modify;
                            }
                            break;

                        case XmlElementNames.Read:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.Read;
                            }
                            break;

                        case XmlElementNames.ViewPrivateItems:
                            if (reader.ReadElementValue <bool>())
                            {
                                value |= EffectiveRights.ViewPrivateItems;
                            }
                            break;
                        }
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, this.XmlElementName));
            }

            propertyBag[this] = value;
        }
Ejemplo n.º 5
0
        internal override void LoadPropertyValueFromJson(object value, ExchangeService service, PropertyBag propertyBag)
        {
            EffectiveRights effectiveRightsValue = EffectiveRights.None;
            JsonObject      jsonObject           = value as JsonObject;

            if (jsonObject != null)
            {
                foreach (string key in jsonObject.Keys)
                {
                    switch (key)
                    {
                    case XmlElementNames.CreateAssociated:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.CreateAssociated;
                        }
                        break;

                    case XmlElementNames.CreateContents:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.CreateContents;
                        }
                        break;

                    case XmlElementNames.CreateHierarchy:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.CreateHierarchy;
                        }
                        break;

                    case XmlElementNames.Delete:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.Delete;
                        }
                        break;

                    case XmlElementNames.Modify:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.Modify;
                        }
                        break;

                    case XmlElementNames.Read:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.Read;
                        }
                        break;

                    case XmlElementNames.ViewPrivateItems:
                        if (jsonObject.ReadAsBool(key))
                        {
                            effectiveRightsValue |= EffectiveRights.ViewPrivateItems;
                        }
                        break;
                    }
                }
            }

            propertyBag[this] = value;
        }