29-11-2011 : Remettre dans le débat politique les principes du Conseil National de la Résistance
17-02-2012 : Pétition pour une protection de l’apiculture et des consommateurs face au lobby des OGM
Logo de mon site
Logo de mon site
Faire un don

Luxpopuli / eZ Publish / eZ Publish: Documentation technique / eZ Publish : Features -- Fonctionnalités / Advanced redirection after login -- Système avancé de redirection après connexion





Right menu

Logo du site ez.no  Logo XHTML 1.O du W3C  Logo XHTML 1.O du W3C  Site francophone officiel de Firefox
zero papier grâce aux catalogues et promos en ligne de bonial

Advanced redirection after login -- Système avancé de redirection après connexion

Date de publication: le mardi 22 novembre 2011 à 23h39
Dernière modification: par Pascal BOYER le mercredi 23 novembre 2011 à 00h23

28/09/2010 10:43

versions 4.3+

Il n'y a pas de proposition qui ne suppose l'univers entier. Dire «le tigre», c'est dire les tigres qui l'engendrèrent,
les cerfs et les tortues qu'il dévora,
l'herbe dont se nourrissent les cerfs,
la terre qui fut la mère de l'herbe,
le ciel qui donna le jour à la terre.
 

Jorge Luis Borges

In eZ publish 3.8 you can configure where to redirect a user when he/she logs in to the system. To enable this possibility for users, do the following: 
Avec eZ Publish 3.8 vous pouvez configurer la page vers laquelle sera redirigé l'utilisateur après s'être logué au système. Pour cela, suivez les étapes décrites ci-après:

  1. Add an attribute of the "Text line" datatype to your user class. If you have several user classes and wish to enable advanced redirection for all of them then you should add this attribute to each of your user classes (make sure you enter the same attribute identifier for all of them). 
    Ajoutez à votre classe user un attribut basé sur le datatype Ligne de texte . Si vous avez plusieurs classes user et souhaitez activer la redirection avancée pour chacune d'elles, alors vous devez ajouter cet attribut dans chacune de vos classes (assurez-vous de choisir un même identifiant pour chaque attribut Ligne de texte ajouté).
  2. Specify the identifier of the newly added attribute in the "LoginRedirectionUriAttribute" setting located in the "[UserSettings]" section of the "settings/siteaccess/example/site.ini.append.php" configuration file (replace "example" with the actual name of your siteaccess) like this: 
    Spécifiez l'identifiant du nouvel attribut dans le paramètre LoginRedirectionUriAttribute de la section [UserSettings] du fichier de configuration site.ini.append.php de votre siteaccess example (remplacez example par le vrai nom de votre siteaccess), comme ceci:

    LoginRedirectionUriAttribute[key]=attribute_id
    key There are two keys that can be used: "user" for user class(es) or "group" for user group class(es).
    Deux clefs peuvent être utilisées: user pour la/les classe(s) d'utilisateurs ou group pour la/les classe(s) de groupes d'utilisateurs.
    attribute_id The identifier of the newly added attribute (not ID number of the attribute).
    L'identifiant de nouvel attribut (et non pas le numéro de ID de l'attribut).

Now you can specify the redirection URI in the text line field when creating/editing a user.
Vous pouvez à présent spécifier l'URI de redirection dans le champ texte lorsque vous créez/éditez un utilisateur.

This possibility can be also enabled for user groups in the same way as for users. This means that you should add an attribute of the "Text line" datatype to your user group class(es) and specify its identifier in the "LoginRedirectionUriAttribute" setting using "group" as a key.
Cette possibilité peut également être activée, de la même manière, pour les groupes d'utilisateurs. Cela signifie que vous devez ajouter à vos classes de groupe d'utilisateurs, un attribut basé sur le datatype Ligne de texte . et spécifier sont identifiant dans le paramètre LoginRedirectionUriAttribute en utilisant la clef group.

Exemple 1

Let's say that a user must be redirected to the "News" folder after log-in. The following list reveals how this could be done:
Supposons que l'on souhaite rediriger un utilisateur vers le dossier News après qu'il se soit connecté. Voici alors la marche à suivre:

  1. Access the "Setup" tab in the administration interface, click "Classes" on the left and select the "Users" class group. You should see the list of classes assigned to this group. Find your user class there and click the "Edit" button located in the same line of the list. You will be taken to the class edit interface. Select the "Text line" datatype from the drop-down list located in the bottom, click the "Add attribute" button and edit the newly added attribute as shown below. Click "OK" to save your changes.
    Cliquez sur l'onglet Administration de l'interface d’administration puis sur le lien Classes dans le menu gauche. Sélectionnez ensuite le groupe de classes Users. La liste des classes assignées à ce groupe apparaît alors. Cliquez sur l'icône d'édition de votre classe d'utilisateur pour afficher l'interface d'édition de classe à partir de laquelle vous pouvez choisir, dans le menu déroulant situé au bas de l'interface, le datatype Ligne de texte. Ceci fait, cliquez sur le bouton Ajouter l'attribut pour éditer cet attribut, comme l'illustre la figure ci-dessous. Cliquez sur le bouton OK pour sauvegarder vos modifications.

    Redirection avancée après connexion

  2. Specify the identifier of the newly added attribute in the "LoginRedirectionUriAttribute" setting located under the "[UserSettings]" section of an override for the "settings/site.ini" configuration file. To do this, you should add the following line:
    Spécifiez l'identifiant du nouvel attribut dans le paramètre LoginRedirectionUriAttribute de la section [UserSettings] d'une surcharge du fichier de configuration settings/site.ini Pour cela, vous devez ajouter la ligne suivante:

    LoginRedirectionUriAttribute[user]=redirection_uri

    where "redirection_uri" is the attribute identifier.
    redirection_uri représente l'identifiant de l'attribut.

  3. Access the "User accounts" tab in the administration interface, use the "Sub items" list to find the user and click the "Edit" button located in the same line of the list. You will be taken to the user edit interface. Specify "/news" in the text field called "Redirection URI" (the name of the newly added class attribute) as shown below. Click the "Send for publishing" button to save your changes and the user "John" will be always redirected to the "News" folder after log-in.
    Cliquez sur l'onglet Comptes utilisateurs de l'interface d’administration puis recherchez, dans le cadre Sous-éléments, l'utilisateur. Cliquez sur l'icône d'édition pour afficher l'interface d'édition d'utilisateur et spécifiez /news dans le champ texte nommé Redirection URI (c'est le nom de nouvel attribut), comme illustré ci-dessous. Cliquez sur le bouton Envoyer pour publication pour sauvegarder vos modifications et afin que l'utilisateur soit toujours redirigé vers le répertoire News après s'être connecté.

    Redirection avancée après connexion

Exemple 2

Let's say that you wish to redirect all users that belong to the "Guest accounts" group to the "News" folder after log-in. The following list reveals how this could be done: 
Supposons à présent que vous souhaitiez rediriger tous vos utilisateurs appartenant au groupe Guest accounts vers le répertoire News. Voici la marche à suivre:

  1. Edit your user group class and add an attribute of the "Text line" datatype as shown below: 
    Éditez votre classe de groupe d'utilisateurs et ajoutez un attribut basé sur le datatype Ligne de texte , comme ceci:

    Redirection avancée après connexion

  2. Add the following line into the "[UserSettings]" section of an override for the "settings/site.ini" configuration file:
    Ajouter la ligne suivante à la section [UserSettings] d'une surcharge du fichier de configuration settings/site.ini:

    LoginRedirectionUriAttribute[group]=start_page

    where "start_page" is the attribute identifier.
    start_page représente l'identifiant de l'attribut.

  3. Edit the "Guest accounts" user group and specify "/news" in the text field called "Start page" (the name of the newly added class attribute) as shown below.
    Éditez le groupe d'utilisateurs Guest accounts et spécifiez /news dans le champ texte nommé Start page (c'est le nom de nouvel attribut), comme ceci:

    Redirection avancée après connexion

    Click the "Send for publishing" button to save your changes and all the users that belong to the "Guest accounts" group will be always redirected to the "News" folder after log-in.
    Cliquez sur le bouton Envoyer pour publication pour sauvegarder vos modifications et afin que chaque utilisateur du groupe Guest accounts soit toujours redirigé vers le répertoire News après s'être connecté.

Important notes / Notes importantes

If a user is a member of several groups (a child of several "User group" nodes), the system will use the redirection URI that is specified for the "main" group (main parent node). The following screenshot shows the user view interface for the user John that belongs to both "Guest accounts" and "Editors" user groups. The "Locations" list located under user preview allows to view and manage locations for the user object that is currently being viewed. The main location is displayed in a bold type ("Users / Guest accounts / John Doe" in our example).
Si un utilisateur est membre de plusieurs groupes (un enfant de plusieurs noeuds User group), alors le système utilise l'URI de redirection spécifiée dans le groupe principal (noeud parent principal). La capture d'écran ci-dessous montre l'interface de visualisation d'utilisateur dans le cas de l'utilisateur John qui appartient à la fois au groupe d'utilisateurs Guest accounts et Editors. Le cadre Emplacements situé sous le cadre de pré-visualisation de l'utilisateur John permet de voir et de gérer les emplacements de l'objet user qui est actuellement considéré. L'emplacement principal est affiché en caractère gras ( Users / Guest accounts / John Doe dans notre exemple).

Redirection avancée après connexion

Please note that the advanced redirection feature will get disabled if the redirection URI is already specified (e.g. via the "LastAccessesURI" session variable. Let's say that you have specified "/news" as the redirection URI for user John (see Example 1). If John launches a browser and goes directly to for example "http://yoursite.com/media_files" then he will not be redirected to "http://yoursite.com/news".
Retenez que le système avancé de redirection sera désactivé si l'URI de redirection est déjà spécifié (e.g. par la variable de session LastAccessesURI). Supposons que vous ayez spécifié, pour John, /news comme URI de redirection (voir exemple 1). Si John lance son navigateur et va, par exemple, directement à l'adresse http://yoursite.com/media_files, alors il ne sera pas redirigé vers http://yoursite.com/news

Commentaires