<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>flgarrid</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/flgarrid/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/flgarrid/feed.xml</link>
    <description>Technology, News and more</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:09:34 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Symfony2 multi tenant solution</title>
      <link>https://docs.microsoft.com/archive/blogs/flgarrid/symfony2-multi-tenant-solution</link>
      <pubDate>Mon, 05 May 2014 17:38:00 GMT</pubDate>
      <dc:creator><![CDATA[Francisco Garrido Matta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/flgarrid/2014/05/05/symfony2-multi-tenant-solution/</guid>
      <description><![CDATA[Over the last month I've been busy developing a website hosted on Azure (PaaS) which was easier than...]]></description>
      <content:encoded><![CDATA[<p>Over the last month I've been busy developing a website hosted on Azure (PaaS) which was easier than expected to deploy.</p>
<p>Today I'd like to share a multitenant solution I developed for Symfony which came out very elegant and easy to use:</p>
<p>&nbsp;</p>
<p>What I wanted was a way to include several customers under the same domain (and subdomain) with no passing of additional variables to control the current tenant over the different controllers. Specifically, what I wanted was a way to point to a tenant with the following structure:</p>
<pre class="scroll"><code class="php">{domain.com}/{tenant}/{controller}</code></pre>
<p>But of course that wasn't as easy as expected, so here is the code I used to make it work:</p>
<pre class="scroll"><code class="php">app/config/routing.yml<br /> <br /> vendor_my:<br /> resource: "@VendorMyBundle/Controller/"<br /> type: annotation<br /> prefix: /{tenant}</code></pre>
<p>I used FOSUserBundle, so it had to be configured too:</p>
<pre class="scroll"><code class="php">app/config/security.yml<br /> <br /> firewalls:<br /> main:<br /> pattern: ^/<br /> form_login:<br /> provider: fos_userbundle<br /> login_path: fos_user_security_login<br /> check_path: fos_user_security_check<br /> csrf_provider: form.csrf_provider<br /> success_handler: my.login_success_handler<br /> default_target_path: administration<br /> anonymous: true<br /> logout:<br /> path: fos_user_security_logout<br /> target: fos_user_security_login<br /> <br /> access_control:<br /> - { path: .*/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }<br /> - { path: .*/, role: ROLE_USER }</code></pre>
<p>Note that the last two lines have some minor regex changes so it can accept any tenant</p>
<p>Then I had to include a EventListener to save the tenant configuration in the session after a user has successfully logged in</p>
<pre class="scroll"><code class="php">/src/Vendor/MyBundle/EventListener/TenantListener.php<br /> <br /> namespace Vendor\MyBundle\EventListener;<br /> <br /> use Symfony\Component\HttpKernel\Event\GetResponseEvent;<br /> use Symfony\Component\HttpKernel\KernelEvents;<br /> use Symfony\Component\EventDispatcher\EventSubscriberInterface;<br /> <br /> class TenantListener implements EventSubscriberInterface<br /> {<br /> private $defaultTenant;<br /> private $router;//add<br /> private $context;<br /> <br /> public function __construct($defaultTenant, \Symfony\Component\Routing\Router $router, \Symfony\Component\Security\Core\SecurityContext $context)<br /> {<br /> $this-&gt;defaultTenant = $defaultTenant;<br /> $this-&gt;router = $router;<br /> $this-&gt;context = $context;<br /> }<br /> <br /> public function onKernelRequest(GetResponseEvent $event)<br /> {<br /> $request = $event-&gt;getRequest();<br /> if($request-&gt;attributes-&gt;has('tenant')){<br /> $this-&gt;defaultTenant=$request-&gt;attributes-&gt;get('tenant');<br /> }<br /> if ($this-&gt;context-&gt;isGranted('ROLE_USER')||$this-&gt;context-&gt;isGranted('ROLE_ADMIN')) {<br /> $this-&gt;defaultTenant = $request-&gt;getSession()-&gt;get('tenant');<br /> } else {<br /> $request-&gt;getSession()-&gt;set('tenant', $this-&gt;defaultTenant);<br /> $request-&gt;attributes-&gt;set('tenant', $this-&gt;defaultTenant);<br /> }<br /> $this-&gt;router-&gt;getContext()-&gt;setParameter('tenant',$request-&gt;getSession()-&gt;get('tenant'));<br /> }<br /> <br /> public static function getSubscribedEvents()<br /> {<br /> return array(<br /> // must be registered before the default Locale listener<br /> KernelEvents::REQUEST =&gt; array(array('onKernelRequest', 17)),<br /> );<br /> }<br /> }</code></pre>
<p>And register the Listener under /app/config/config.yml</p>
<pre class="scroll"><code class="php">services:<br /> vendor.tenant_listener:<br /> class: Vendor\MyBundle\EventListener\TenantListener<br /> arguments: ["%default_tenant%", @router, @security.context]<br /> tags:<br /> - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }</code></pre>
<p>With this solution I can pass the 'tenant' variable throughout the session so that every controller or twig can use it. Note that even if the user changes the tenant url, the variable considered is the one that was registered at the time of the login.</p>
<p>Now I can have a custom login theme for every tenant:</p>
<p>Extending the FOSUserBundle Controller in my Bundle:</p>
<pre class="scroll"><code class="php">/src/Vendor/MyBundle/Controller/SecurityController.php<br /> <br /> namespace Vendor\MyBundle\Controller;<br /> <br /> use Symfony\Component\HttpFoundation\RedirectResponse;<br /> use FOS\UserBundle\Controller\SecurityController as BaseController;<br /> use Symfony\Component\HttpFoundation\Request; <br /> <br /> class SecurityController extends BaseController<br /> {<br /> <br /> protected function renderLogin(array $data)<br /> {<br /> $tenant = $this-&gt;container-&gt;get('request')-&gt;getSession()-&gt;get('tenant');<br /> <br /> ....</code></pre>
<p>I can then check the tenant info passed in the Listener and use it to have a different experience for different tenants.</p>
<p>&nbsp;</p>
<p>Great, right? Next post will be about checking if the current user belongs to the right tenant... To be continued</p>]]></content:encoded>
    </item>
    <item>
      <title>MDOP y el fin del soporte de XP</title>
      <link>https://docs.microsoft.com/archive/blogs/flgarrid/mdop-y-el-fin-del-soporte-de-xp</link>
      <pubDate>Mon, 11 Feb 2013 17:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Francisco Garrido Matta]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/flgarrid/2013/02/11/mdop-y-el-fin-del-soporte-de-xp/</guid>
      <description><![CDATA[En un primer lugar quisiera referirme a MDOP, porque es una herramienta que muy poca gente conoce....]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">En un primer lugar quisiera referirme a MDOP, porque es una herramienta que muy poca gente conoce. MDOP en su versi&oacute;n 2012 facilita el despliegue de un nuevo sistema operativo dentro de una organizaci&oacute;n y est&aacute; disponible s&oacute;lo para clientes con Software Assurance (Licenciamiento por Volumen).</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Qu&eacute; permite hacer MDOP? Divid&aacute;moslo en tres grandes grupos:Virtualizaci&oacute;n, Administraci&oacute;n y Diagn&oacute;stico/Reparaci&oacute;n. No quiero centrar el art&iacute;culo en esto, porque ya hay un <a href="https://www.microsoft.com/es-es/windows/enterprise/products-and-technologies/mdop/default.aspx">sitio que tiene la descripci&oacute;n completa</a>.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Dentro del primer gran grupo (Virtualizaci&oacute;n) se encuentra MED-V, que permite &ndash;en t&eacute;rminos simples&ndash; distribuir y administrar una imagen del Modo XP dentro de la organizaci&oacute;n. Qu&eacute; beneficios tiene esto versus el Modo XP? A&uacute;n m&aacute;s simple: Qu&eacute; beneficio tiene esto versus correr Windows XP como mi sistema operativo base? Veamos:</span></p>
<p style="padding-left: 30px;"><strong><span style="font-family: arial,helvetica,sans-serif; font-size: small;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Qu&eacute; beneficio tiene MED-V versus XP como sistema operativo base?</span></strong></p>
<p style="padding-left: 30px;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Han escuchado sobre el <a href="https://www.microsoft.com/es-es/windows/endofsupport.aspx">fin del soporte de XP</a>? As&iacute; de simple.</span></p>
<p style="padding-left: 30px;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Lo s&eacute;, me lo han dicho en innumerables ocasiones: Esa es una respuesta mezquina y antojadiza de parte de Microsoft s&oacute;lo para cobrar por otro sistema operativo que hace exactamente lo mismo. Dentro de todo, XP funciona muy bien!</span></p>
<p style="padding-left: 30px;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Hasta ahora. Qu&eacute; est&aacute; pasando con los equipos nuevos, con todas sus nuevas caracter&iacute;sticas (como pantallas touch, m&oacute;dulos de seguridad TPM, discos eDrive)? No est&aacute; contemplado siquiera que soporten este antiguo sistema operativo. Pero el asunto va m&aacute;s all&aacute; todav&iacute;a. <a href="https://www.microsoft.com/en-us/download/details.aspx?id=29883">Estudios demuestran</a> que XP aumenta los costos de administraci&oacute;n y disminuye la productividad de los trabajadores, en comparaci&oacute;n con nuevos&nbsp;sistemas operativos.</span></p>
<p style="padding-left: 30px;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">No logr&eacute; convencerlos? D&eacute;jenme sus argumentos en los comentarios y tengamos una conversaci&oacute;n al respecto.</span></p>
<p style="padding-left: 30px;"><strong><span style="font-family: arial,helvetica,sans-serif; font-size: small;">2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Qu&eacute; beneficio tiene MED-V versus el Modo XP?</span></strong></p>
<p style="padding-left: 30px;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">El Modo XP no permite administrar la imagen que se instala dentro de la organizaci&oacute;n. Podr&iacute;a configurarse una imagen corporativa de Windows 7 con el modo XP ya configurado (lo que puede ser muy tedioso), pero al momento de querer hacer una actualizaci&oacute;n sobre &eacute;sta, la cosa ya no es tan simple. MED-V simplifica la administraci&oacute;n de estas im&aacute;genes y no es necesario desplegar una imagen nueva de Windows 7 cada vez que ocurra un cambio o una por cada grupo de usuarios.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">MED-V estar&aacute; soportado por un tiempo m&aacute;s, <a href="https://support.microsoft.com/lifecycle/search/default.aspx?sort=PN&amp;alpha=desktop+virtualization&amp;Filter=FilterNO">hasta diciembre del 2016</a>, pero esto no significa que ser&aacute; una forma de extender el soporte de XP. MED-V recibir&aacute; actualizaciones, sin embargo, el sistema operativo &ldquo;guest&rdquo; (XP), no recibir&aacute; actualizaciones a partir de abril del 2014. Los riesgos de seguridad seguir&aacute;n latentes.</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">Quisiera dedicar un p&aacute;rrafo tambi&eacute;n a transmitir la necesidad de modernizar estas aplicaciones no soportadas por los nuevos sistemas operativos, o en su defecto, reemplazarlas. Probablemente ya existen </span><span style="font-family: arial,helvetica,sans-serif; font-size: small;">soluciones en el mercado que pueden entregar soluciones m&aacute;s completas y robustas que estas antiguas aplicaciones. El mundo ha cambiado desde el 2001 y el ambiente en que se dise&ntilde;aron esas aplicaciones probablemente ya no es el mismo que en el que se encuentran en la actualidad (de lo contrario, ese ambiente debe estar muy alejado de la realidad).</span></p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: small;">En resumen, la idea es concientizar sobre los costos que actualmente implica administrar un ambiente de trabajo con XP y los problemas de productividad que conlleva. Microsoft cuenta con herramientas (Como MED-V) que pueden ayudar a mitigar las dificultades que surgen al migrar a un nuevo sistema operativo, sin dejar de lado el mensaje principal: <a href="https://blogs.windows.com/windows/b/business/archive/2010/06/29/research-study-reports-business-value-of-windows-7.aspx">los costos de actualizar</a> en estos momentos son menores a los costos de mantener una plataforma dise&ntilde;ada hace m&aacute;s de 11 a&ntilde;os.</span></p>]]></content:encoded>
    </item>
  </channel>
</rss>