protected override void PreDeleteInsideTransaction(BusinessContext context)
        {
            base.PreDeleteInsideTransaction(context);

            DirectoryOrganizationalUnitEntity entity = (DirectoryOrganizationalUnitEntity)BusinessManager.Load(DirectoryOrganizationalUnitEntity.ClassName, context.GetTargetPrimaryKeyId().Value);

            if (entity.ParentId == null)
            {
                throw new AccessDeniedException("Can not delete root.");
            }

            // TODO: Child Business Unit

            // TODO: Delete Users

            // TODO: Delete Team

            // TODO: Delete Role

            // Remove BusinessUnit From Principal
            DirectoryManager.DeletePrincipal(context.GetTargetPrimaryKeyId().Value);

            // Remove BusinessUnitScopeId From Principal
            DirectoryManager.DeletePrincipal((PrimaryKeyId)entity.OrganizationalUnitScopeId);
        }
Esempio n. 2
0
        protected override void PreDeleteInsideTransaction(BusinessContext context)
        {
            base.PreDeleteInsideTransaction(context);

            // Remove SecureRole From Principal
            DirectoryManager.DeletePrincipal(context.GetTargetPrimaryKeyId().Value);
        }