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

SetSecurableObjectInheritance() private method

private SetSecurableObjectInheritance ( bool breaksInheritance ) : void
breaksInheritance bool
return void
        internal void SetSecurableObjectInheritance(bool breaksInheritance)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (IGlymaSession glymaSession = new WebAppSPGlymaSession(Context.WebUrl))
                {
                    using (IDbConnectionAbstraction connectionAbstraction = glymaSession.ConnectionFactory.CreateSecurityDbConnection())
                    {
                        using (SecurityServiceDataContext dataContext = new SecurityServiceDataContext(connectionAbstraction.Connection))
                        {
                            SecurableObject securableObject = (from so in dataContext.SecurableObjects
                                                               where so.SecurableObjectUid == SecurableObject.SecurableObjectUid &&
                                                               so.SecurableContextId == SecurableContextId
                                                               select so).First();
                            securableObject.BreaksInheritance = breaksInheritance;
                            dataContext.SubmitChanges();
                        }
                    }
                }
            });
        }

Usage Example

Ejemplo n.º 1
0
        internal ResponseObject BreakRootMapInheritance(GlymaSecurableObject securableObject)
        {
            ResponseObject response = new ResponseObject()
            {
                HasError = false
            };

            try
            {
                GetSecurableContextIdResponse securableContextIdResponse = GetSecurableContextId();
                if (!securableContextIdResponse.HasError)
                {
                    int                         securableContextId = securableContextIdResponse.Result;
                    SecurableObject             obj = GetSecurableObject(securableContextId, securableObject.SecurableObjectUid);
                    GlymaSecurableObjectContext securableObjectContext = new GlymaSecurableObjectContext(this, securableContextId, securableObject);
                    if (obj == null)
                    {
                        obj = securableObjectContext.CreateSecurableObject(true);
                    }
                    if (!obj.BreaksInheritance)
                    {
                        securableObjectContext.SetSecurableObjectInheritance(true);
                    }
                    CopyGroupAssociationsToRootMap(securableObject);
                }
            }
            catch (Exception ex)
            {
                response.HasError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
All Usage Examples Of Glyma.SharePoint.Security.GlymaSecurableObjectContext::SetSecurableObjectInheritance