Configure um site Plone com conteúdos públicos e privados
Um esquema relativamente simples para configurar seu site Plone 3 com com acesso público (ex: anônimo), para membros e restrito.
Propósito
Este documento explica como configurar seu site Plone 3 para que alguns conteúdos sejam acessíveis para usuários anônimos, outros apenas para usuários autenticados, e outros conteúdos sejam apenas acessíveis para membros de grupos específicos. Nenhum produto adicional, ou instruções especiais para usuários finais são necessários. Serão usados o Workflow e regras locais.
Caso Exemplo
As instruções passo a passo são para um site com os seguintes requisitos:
- por padrão, o conteúdo é acessível apenas por usuários autenticados
- alguns conteúdos devem ser acessíveis a pessoas que não estão autenticadas
- conteúdos restritos não devem estar acessíveis a usuários normais ou usuários anônimos (inclusive através de busca)
- usuários normais não devem estar cientes que existem áreas restritas no website
- usuários finais não devem precisar seguir instruções especiais após criar conteúdos
Outros exigências podem ser satisfeitas alterando os passos abaixo. Os passos mostrados tem o objetivo de ser simples.
Neste exemplo eu usarei o Workflow de Intranet/Extranet que vem com o Plone 3. Ele define 3 estados para conteúdos que podem ser usados para definir diferntes níveis de acesso para pastas (e seus conteúdos). Um quarto estado é usado, o estado padrão, o qual herda as permissões da pasta onde ele está.
- Publicado internamente: este é o estado para o conteúdo que é para ser acessado apenas por membros
- Externo: este é o estado para conteúdo acessível também para usuários anônimos (ex. que não estão autenticados)
- Privado: este é o estado que será usado para áreas de acesso restrito - apenas membros de grupos específicos poderão acessar
- Interno: este é o estado padrão de qualquer conteúdo novo, ele herda as permissões de acesso da pasta pai
Passo a passo
Passo 1: Escolha o workflow
- Vá até Configurações do Site -> Configurações do Plone -> Tipos
- Se o workflow de "Intranet/Extranet" não for o workflow atual, escolha este workflow e aplique as mudanças e aguarde
Passo 2: Modificar os workflows por tipo
- Vá até a interface de Gerência do Zope (Configurações do Site -> Configurações do Plone -> Interface de Gerência do Zope)
- Clique em portal_workflow
- No final desta página, coloque no workflow Default: intranet_workflow [já deve estar assim]
- Para File coloque (Default)
- Para Document coloque (Default)
- Para Folder coloque (Default)
- Clique no botão "Change"
Passo 3: Modifique as permissões do workflow
- Em portal_workflow, clique na guia Contents
- Clique em intranet_workflow
- Clique na guia States
- Clique em estado internal (deve haver um asterisco indicando que este é o estado padrão)
- Clique na guia Permissions
- Altere as configurações para igualar com a figura abaixo. Como você poder ver, usuários anônimos e membros somente terão acesso a conteúdos se eles herdarem este privilégio do conteiner.

Configurações de permissão para o estado interno do workflow de Intranet/Extranet
- Clique no botão Save Changes
- Clique no botão Save Changes e clique em portal_workflow no caminho mostrado no topo para voltar quatro níveis. Os outros estados deve ser deixados como eles estavam definidos originalmente.
-
Importante: Clique no botão Update Security Settings. Isto irá aplciar as configurações que você fez a todos os arquivos e pastas. Novos arquivos e pastas irão ter estas configurações aplicadas assim que forem criados.
Passo 4: Configure as pastas para o conteúdo
- To keep things organized, material should only be placed in folders, not in the root of the plone site. Create the top level folders with the plone interface to give your site some organization. Decide which are to be open, open to members, and open only to certain members. The folders should be put into the corresponding external, internally published, and private states respectively. Do this through the plone interface, either within the contents view or by using the element labeled State in the green bar.
- You can authorize members or special groups to add or modify content within folders by clicking on the sharing tab, and selecting the appropriate options.
- Note that internal files in the root of the plone instance (index_html, for example) will be accessible by anonymous.
- As material is added into the folders, by default they will have the internal state, giving them the same access as their parent folder. If needed, individual elements can have their access changed to one of the three other states with definitive access (external, internally published, or private).
- Internal files and subfolders in a private folder will not be accessible by regular users. To allow a group of members to have access, you must create a group, then give that group the manager role for that folder, as follows:
- Go to Site Setup -> Plone configuration -> Users and Groups
- Click on the Groups tab, and create a new group. No need to give any special role to the new group.
- Add the set of members that need to access a private folder. Note you can setup several groups each having access to different sets of private folders.
- Within plone, find the private folder that you want to allow group access
- Click on that folder, and then on the Sharing tab
- Enter the name of the group in the search box, and give that group the special permissions.
Step 5: Setup tabs for private folders
If a common home page is used for all members, there should be no links to private folders on the page - as they will only work for members of the groups that have access to them. Instead, tabs can be used so that they appear only for those that have access to the private folders. In Plone 3, the default is to show a tab for all folders that are accessible to the member. This may generate too many tabs for your users, so to limit the number of tabs one has to setup the tabs by hand as follows:
- Go to Site Setup -> Plone configuration -> Navigation
- Uncheck the box labeled: Automatically generate tabs
- Go to the Zope Management Interface
- Click on portal_actions
- Click on portal_tabs
- Click the Add button on the upper right to add a new CMF action
- Enter the following information (elements with underscore to be replaced with appropriate names)
- Title: the title that you want to appear in the tab
- URL: string:${globals_view/navigationRootUrl}/restricted_folder_name
- Condition: python: member and (member.id in here.portal_groups.getGroupById('group_name').getAllGroupMemberIds())
- Permissions: click on View here... not sure what this is for!?
- Click on the button labeled "Save Changes"
Step 6: Remove Searchbox for anonymous users
If you don't want anonymous users using the plone search feature on your site, you can do the following:
- Go to the Zope Management Interface
- Click on portal_view_customizations
- Click on plone.searchbox near the bottom of the list
- Click on customize
- Add to the end of the first line: tal:condition="python:user.has_role('Member')"
