Glyma.SharePoint.Security.GlymaSecurableObjectContext.GetIsInherited C# (CSharp) Method

GetIsInherited() private method

private GetIsInherited ( ) : bool
return bool
        internal bool GetIsInherited()
        {
            bool result = false;
            if (SecurableObject.SecurableParentUid != Guid.Empty)
            {
                SecurableObject securableObject = Context.GetSecurableObject(SecurableContextId, SecurableObject.SecurableObjectUid);
                if (securableObject != null)
                {
                    result = !securableObject.BreaksInheritance;
                }
                else
                {
                    result = true;
                }
            }
            return result;
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Gets the current security associations for a list of groups against a particular securable object
        /// </summary>
        /// <param name="webUrl">The URL for the SP site</param>
        /// <param name="glGroups">A list of groups to get the security assocations for</param>
        /// <param name="securableObject">An object that contains the Parent and Object ID's
        ///                                 SecurableParentUid: The ID of the securable parent (Guid.Empty for projects),
        ///                                 SecurableObjectUid: The ID of the securable object (root map UID or project UID if securing a project)</param>
        /// <returns>A dictionary of security association, Key: the group, Value: True if the group has an assocation. (wrapped in a Response Object to indicate if any errors occured)</returns>
        internal GetSecurityAssociationsResponse GetSecurityAssociations(IEnumerable <GlymaSecurityGroup> glGroups, GlymaSecurableObject securableObject)
        {
            GetSecurityAssociationsResponse result = new GetSecurityAssociationsResponse()
            {
                HasError = false
            };

            if (this.CurrentUser.IsUserSecurityManager())
            {
                SecurityAssociations securityAssociations     = new SecurityAssociations();
                Dictionary <GlymaSecurityGroup, bool> results = new Dictionary <GlymaSecurityGroup, bool>();
                SecurableContext securableContext             = GetSecurableContext();
                int securableContextId = securableContext.SecurableContextId;
                GlymaSecurableObjectContext securableObjectContext = new GlymaSecurableObjectContext(this, securableContextId, securableObject);
                bool isInherited = securableObjectContext.GetIsInherited();

                foreach (GlymaSecurityGroup glymaSecurityGroup in glGroups)
                {
                    try
                    {
                        GlymaSecurityAssociationContext securityAssociationContext = new GlymaSecurityAssociationContext(this, glymaSecurityGroup, securableObject);
                        bool response = securityAssociationContext.HasAssociation();
                        results.Add(glymaSecurityGroup, response);
                    }
                    catch (Exception ex)
                    {
                        result.HasError     = true;
                        result.ErrorMessage = ex.Message;
                    }
                }
                if (!result.HasError)
                {
                    securityAssociations.HasAssociations = results;
                    securityAssociations.IsInherited     = isInherited;
                    result.Result = securityAssociations;
                }
            }
            else
            {
                result.HasError     = true;
                result.ErrorMessage = "Access Denied. User does not have permissions to access this web service method.";
            }

            return(result);
        }
All Usage Examples Of Glyma.SharePoint.Security.GlymaSecurableObjectContext::GetIsInherited