Esempio n. 1
0
        /// <summary>Sets the permissions for the specified entity set resource.</summary>
        /// <param name="name">The Name of the entity set for which to set permissions.</param>
        /// <param name="rights">The Access rights to be granted to this resource, passed as an <see cref="T:Microsoft.OData.Service.EntitySetRights" /> value.</param>
        public void SetEntitySetAccessRule(string name, EntitySetRights rights)
        {
            this.CheckNotSealed();
            if (name == null)
            {
                throw Error.ArgumentNull("name");
            }

            WebUtil.CheckResourceContainerRights(rights, "rights");
            if (name == "*")
            {
                this.rightsForUnspecifiedResourceContainer = rights;
            }
            else
            {
                ResourceSet container;
                if (!this.provider.TryResolveResourceSet(name, out container) || container == null)
                {
                    throw new ArgumentException(Strings.DataServiceConfiguration_ResourceSetNameNotFound(name), "name");
                }

                this.resourceRights[container.Name] = rights;
            }
        }