<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog d&#039;Orditeck &#187; Web</title>
	<atom:link href="http://blog.orditeck.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.orditeck.com</link>
	<description></description>
	<lastBuildDate>Tue, 19 Apr 2011 13:35:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Un système de permission de mon cru</title>
		<link>http://blog.orditeck.com/2011/04/un-systeme-de-permission-de-mon-cru/</link>
		<comments>http://blog.orditeck.com/2011/04/un-systeme-de-permission-de-mon-cru/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 23:27:31 +0000</pubDate>
		<dc:creator>Keven Lefebvre</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[accès]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[GEL]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[left]]></category>
		<category><![CDATA[metakey]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[substring]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.orditeck.com/?p=369</guid>
		<description><![CDATA[Depuis plusieurs mois déjà, je travaille sur un projet de recherche &#38; développement pour un client. C'est un travail à temps partiel, environ 15 heures par semaine à travers de l'école. Au début, étant sceptique sur la faisabilité de la chose (c'est un projet de recherche &#38; développement hein!) le client était enthousiasme, mais pas [...]]]></description>
			<content:encoded><![CDATA[<p>Depuis plusieurs mois déjà, je travaille sur un projet de recherche &amp; développement pour un client. C'est un travail à temps partiel, environ 15 heures par semaine à travers de l'école. Au début, étant sceptique sur la faisabilité de la chose (c'est un projet de recherche &amp; développement hein!) le client était enthousiasme, mais pas assez à mon goût. Cependant, plus les mois avancèrent, plus le client appréciait l'application web.</p>
<p>Il y a de cela un ou deux mois, j'ai eu les premiers signes d'une ouverture plus grande: on voulait éventuellement le rendre accessible à plus d'employés. C'était déjà fait, certes, mais tous avaient le même niveau d'accès. Ou tous n'en avait pas, pour être plus exact. C'est donc dans cette optique que je me suis mis à réfléchir à un système de permission. J'ai bien songé à aller fouiller sur Google pour me diriger, mais ça ne me disait pas. Étant donné que « ça ne pressait pas vraiment » (d'autres trucs à développer urgeaient davantage) j'y pensais tranquillement, disons.</p>
<p>Finalement, j'ai opté pour une forme très souple (enfin, selon moi): des « metakey » qui auront des valeurs (même si ces dernières sont plus ou moins importantes, dépendant des cas). J'ai donné un code à chaque permission, par exemple 0001 =&gt; afficher x, 0002 =&gt; modifier x, 0003 =&gt; supprimer x. Étant donné que le client a plusieurs projets, ça permet également de donner accès à certains projets à certains employés, via la même table. Pour ça, j'ai opté par un suffixe <em>projet_{idProjet}</em> comme metakey.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$listeDesPermissions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'0001'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Afficher tous les x'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'0002'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Ajouter un x'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'0003'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Supprimer les x'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'0004'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Éditer les x'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>La structure de ma base SQL est la suivante (suivi d'un exemple d'entrées):<br />
<img class="alignleft" src="http://upload.dimatricus.com/jing/screen_H2Qt8.png" alt="" width="81" height="116" /> <img class="alignleft" src="http://upload.dimatricus.com/jing/screen_77DWw.png" alt="" width="220" height="88" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Finalement, dans une requête SQL qui sélectionnera seulement les projets (par exemple) que l'utilisateur est autorité à afficher, je fais un simple LEFT JOIN:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> champ1<span style="color: #66cc66;">,</span> champ2<span style="color: #66cc66;">,</span> champ3 <span style="color: #993333; font-weight: bold;">FROM</span> projets <span style="color: #993333; font-weight: bold;">AS</span> pr
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> permissions <span style="color: #993333; font-weight: bold;">AS</span> pe
<span style="color: #993333; font-weight: bold;">ON</span> pr<span style="color: #66cc66;">.</span>idProjet <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">SUBSTRING</span><span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">.</span>metakey<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> pe<span style="color: #66cc66;">.</span>metavalue <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'1'</span> <span style="color: #993333; font-weight: bold;">AND</span> pe<span style="color: #66cc66;">.</span>uid <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'$uid'</span></pre></div></div>

<p>Le <em>SUBSTRING </em>est présent car mon suffixe <em>projet_{idProjet}</em> fait 7 caractères, je commence donc la lecture au 8ième caractère. La requête ira donc chercher les projets où :<br />
1. l'id du projet est présente en metakey et,<br />
2. la metavalue est à 1 (ce qui veut dire que j'ai affectivement accès) et,<br />
3. l'identifiant du compte est le mien.</p>
<p>Peut-être que ma manière n'est pas la meilleure, je n'ai même pas cherché à comparer. Cependant, elle me permet de faire réellement tout ce dont je peux souhaiter niveau permission. J'aurais de la difficulté à imaginer un système plus simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.orditeck.com/2011/04/un-systeme-de-permission-de-mon-cru/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Équivalence des polices Windows/Mac/Linux</title>
		<link>http://blog.orditeck.com/2009/05/equivalence-des-polices-windowsmaclinux/</link>
		<comments>http://blog.orditeck.com/2009/05/equivalence-des-polices-windowsmaclinux/#comments</comments>
		<pubDate>Sun, 03 May 2009 23:50:44 +0000</pubDate>
		<dc:creator>Keven Lefebvre</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fonts]]></category>
		<category><![CDATA[polices]]></category>

		<guid isPermaLink="false">http://blog.orditeck.com/?p=304</guid>
		<description><![CDATA[Trouver une police équivalente à celle que l'on utilise généralement peut rapidement devenir embêtant quand on veut que ce soit multi-plateformes. Voici une liste des polices les plus courantes ainsi que leurs équivalents sous les différents OS. font-family: Verdana,Geneva,Kalimati,sans-serif; font-family: &#34;Lucida Sans Unicode&#34;,&#34;Lucida Grande&#34;,Garuda,sans-serif; font-family: &#34;Arial Black&#34;,Gadget,sans-serif; font-family: Arial,Helvetica,Garuda,sans-serif; font-family: Georgia,&#34;Nimbus Roman No9 L&#34;,serif; font-family: [...]]]></description>
			<content:encoded><![CDATA[<p>Trouver une police équivalente à celle que l'on utilise généralement peut rapidement devenir embêtant quand on veut que ce soit multi-plateformes.<br />
Voici une liste des polices les plus courantes ainsi que leurs équivalents sous les différents OS.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Verdana<span style="color: #00AA00;">,</span>Geneva<span style="color: #00AA00;">,</span>Kalimati<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Lucida Sans Unicode&quot;</span><span style="color: #00AA00;">,</span><span style="color: #ff0000;">&quot;Lucida Grande&quot;</span><span style="color: #00AA00;">,</span>Garuda<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Arial Black&quot;</span><span style="color: #00AA00;">,</span>Gadget<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span>Helvetica<span style="color: #00AA00;">,</span>Garuda<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span><span style="color: #ff0000;">&quot;Nimbus Roman No9 L&quot;</span><span style="color: #00AA00;">,</span><span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Palatino Linotype&quot;</span><span style="color: #00AA00;">,</span><span style="color: #ff0000;">&quot;Book Antiqua&quot;</span><span style="color: #00AA00;">,</span>Palatino<span style="color: #00AA00;">,</span>FreeSerif<span style="color: #00AA00;">,</span><span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Tahoma<span style="color: #00AA00;">,</span>Geneva<span style="color: #00AA00;">,</span>Kalimati<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Trebuchet MS&quot;</span><span style="color: #00AA00;">,</span>Helvetica<span style="color: #00AA00;">,</span>Jamrul<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">,</span>Times<span style="color: #00AA00;">,</span>FreeSerif<span style="color: #00AA00;">,</span><span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.orditeck.com/2009/05/equivalence-des-polices-windowsmaclinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

