Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 98109a5

Browse filesBrowse files
pt_BR translation
1 parent 858ce77 commit 98109a5
Copy full SHA for 98109a5

File tree

Expand file treeCollapse file tree

4 files changed

+111
-113
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+111
-113
lines changed

‎pt_BR/guides/security/authorization.rst

Copy file name to clipboardExpand all lines: pt_BR/guides/security/authorization.rst
+23-23Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
.. index::
22
single: Security; Authorization
33

4-
Authorization
5-
=============
4+
Autorização
5+
===========
66

7-
When the user is authenticated, you can restrict access to your application
8-
resources via access control rules. Authorization in Symfony2 covers this need
9-
but it also provides a standard and powerful way to decide if a user can
10-
access any resource (a URL, a model object, a method call, ...) thanks to a
11-
flexible access decision manager.
7+
Quando o usuários estiver autenticado, você pode restringir o acesso aos recursos
8+
da sua aplicação usando regras de controle de acesso. A Autorização no Symfony2
9+
cobre essa necessidade mas também provê uma maneira padrão e poderosa de decidir
10+
se o usuário pode acessar algum recurso (uma URL, um model, uma chamada de método, ...)
11+
graças a um flexível gerenciador de decisão de acesso.
1212

1313
.. index::
1414
single: Security; Access Control
1515

16-
Defining Access Control Rules for HTTP resources
17-
------------------------------------------------
16+
Definindo Regras de Controle de Acesso para Recursos HTTP
17+
---------------------------------------------------------
1818

19-
Authorization is enforced for each request, based on access control rules
20-
defined in your configuration:
19+
A Autorização é executada para cara requisição, baseada nas regras de controle
20+
de acesso definidas na sua configuração:
2121

2222
.. configuration-block::
2323

@@ -49,21 +49,21 @@ defined in your configuration:
4949
),
5050
));
5151
52-
For each incoming request, Symfony2 tries to find a matching access control
53-
rule (the first one wins) and throws an
54-
:class:`Symfony\\Component\Security\\Exception\\AccessDeniedException` if the
55-
user has not the needed roles or an
52+
Para cara requisição que chega, o Symfony2 tenta encontrar uma regra de controle de acesso
53+
que case (a primeira a casar é escolhida) e dispara uma
54+
:class:`Symfony\\Component\Security\\Exception\\AccessDeniedException` se o usuário não tiver
55+
as permissões necessárias ou uma
5656
:class:`Symfony\\Component\Security\\Exception\\AuthenticationCredentialsNotFoundException`
57-
if he is not authenticated yet.
57+
se o usuário não estiver autenticado ainda.
5858

59-
In the example above, we match requests based on their path info, but there
60-
are many other ways as you will learn in the next section.
59+
No exemplo acima, nós comparamos as requisições basiadas nas informações do path, mas
60+
tem várias outras maneiras que você vai aprender nessa seção.
6161

6262
..tip::
6363

64-
Symfony2 automatically adds a special role based on the anonymous flag:
65-
``IS_AUTHENTICATED_ANONYMOUSLY`` for anonymous users and
66-
``IS_AUTHENTICATED_FULLY`` for all others.
64+
O Symfony2 automaticamente adiciona uma role especial baseada na flag anônima:
65+
``IS_AUTHENTICATED_ANONYMOUSLY`` para usuários anônimos e
66+
``IS_AUTHENTICATED_FULLY`` para todos os outros.
6767

6868
Matching a Request
6969
------------------
@@ -131,8 +131,8 @@ Access control rules can match a request in many different ways:
131131
.. index::
132132
single: Security; HTTPS
133133

134-
Enforcing HTTP or HTTPS
135-
-----------------------
134+
Executando HTTP ou HTTPS
135+
------------------------
136136

137137
Besides roles, you can also force parts of your website to use either HTTP or
138138
HTTPS:

‎pt_BR/guides/validator/constraints.rst

Copy file name to clipboardExpand all lines: pt_BR/guides/validator/constraints.rst
+50-51Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
Constraints
2-
===========
1+
Restrições
2+
==========
33

4-
The Validator is designed to validate objects against *constraints*.
5-
In real life, a constraint could be: "The cake must not be burned". In
6-
Symfony2, constraints are similar: They are assertions that a condition is
7-
true.
4+
O Validator é projetado para validar objetos com as *restrições*.
5+
Na vida real, uma restrição pode ser: "O bolo não deve estar queimado". No
6+
Symfony2, restrições são similares: Elas são afirmações de que a condição
7+
é verdadeira.
88

9-
Supported Constraints
9+
Restrições Suportadas
1010
---------------------
1111

12-
The following constraints are natively available in Symfony2:
12+
As seguintes restrições são nativamente suportadas pelo Symfony2:
1313

1414
.. toctree::
1515
:hidden:
@@ -36,20 +36,21 @@ The following constraints are natively available in Symfony2:
3636
* :doc:`Url <constraints/Url>`
3737
* :doc:`Valid <constraints/Valid>`
3838

39-
Constraint Targets
40-
------------------
39+
Alvos das Restrições
40+
--------------------
4141

42-
Constraints can be put on properties of a class, on public getters and on the
43-
class itself. The benefit of class constraints is that they can validate
44-
the whole state of an object at once, with all of its properties and methods.
42+
Restrições podem ser colocadas em propriedades de uma classe, em getter publicos
43+
e na própria classe. Os beneficios de restrições em classes é que elas podem
44+
valida o estado inteiro de um objeto de uma só vez, com todas as suas propriedades
45+
e métodos.
4546

46-
Properties
47-
~~~~~~~~~~
47+
Propriedades
48+
~~~~~~~~~~~~
4849

49-
Validating class properties is the most basic validation technique. Symfony2
50-
allows you to validate private, protected or public properties. The next
51-
listing shows how to configure the properties ``$firstName`` and ``$lastName``
52-
of a class ``Author`` to have at least 3 characters.
50+
A validação de propriedades de uma classe é a mais básica das técnicas de validação.
51+
O Symfony2 permite que você valide propriedades privadas, protegidas ou públicas. A
52+
lista a seguir mostra como configurar as propriedades ``$firstName`` e ``$lastName``
53+
da classe ``Author`` para ter no mínimo 3 caracteres.
5354

5455
.. configuration-block::
5556

@@ -100,17 +101,17 @@ of a class ``Author`` to have at least 3 characters.
100101
Getters
101102
~~~~~~~
102103

103-
The next validation technique is to constrain the return value of a method.
104-
Symfony2 allows you to constrain any public method whose name starts with
105-
"get" or "is". In this guide, this is commonly referred to as "getter".
104+
A próxima técnica de validação é restringir o valor do retorno de um método.
105+
O Symfony2 permite que você restrinja qualquer método público em que o nome
106+
comece com "get" ou "is". Nesse guia, ele é referenciado como "getter".
106107

107-
The benefit of this technique is that it allows you to validate your object
108-
dynamically. Depending on the state of your object, the method may return
109-
different values which are then validated.
108+
O beneficio dessa técnica é que ela permite você validar seu objeto dinamicamente.
109+
Dependendo do estato do seu objeto, o método pode retornar diferentes valores que
110+
então são validados.
110111

111-
The next listing shows you how to use the :doc:`AssertTrue
112-
<constraints/AssertTrue>` constraint to validate whether a dynamically
113-
generated token is correct:
112+
A lista a seguir mostra como usar a restrição :doc:`AssertTrue
113+
<constraints/AssertTrue>` para validar se um token gerado dinamicamente está
114+
correto:
114115

115116
.. configuration-block::
116117

@@ -149,19 +150,18 @@ generated token is correct:
149150
150151
.. note::
151152

152-
The keen-eyed among you will have noticed that the prefix of the getter
153-
("get" or "is") is omitted in the mapping. This allows you to move the
154-
constraint to a property with the same name later (or vice versa) without
155-
changing your validation logic.
153+
Se você tem uma visão aguçada, deve ter percebido que o prefixo do getter
154+
("get" ou "is") foi omitido do mapeamento. Isso permite que você mova a
155+
restrição para uma propriedade com o mesmo nome depois (ou vice-versa)
156+
sem mudar a lógica de validação.
156157

157-
Custom Constraints
158-
------------------
158+
Restrições Customizadas
159+
-----------------------
159160

160-
You can create a custom constraint by extending the base constraint class,
161-
:class:`Symfony\\Component\\Validator\\Constraint`. Options for your
162-
constraint are represented by public properties on the constraint class. For
163-
example, the ``Url`` constraint includes ``message`` and ``protocols``
164-
properties::
161+
Você pode criar restrições customizadas estendendo a classe base de restrições
162+
:class:`Symfony\\Component\\Validator\\Constraint`. As opções das suas restrições
163+
são representadas como propriedades públicas na classe de restrição. Por exemplo,
164+
a restrição ``Url`` inclui as propriedades ``message`` e ``protocols``::
165165

166166
namespace Symfony\Component\Validator\Constraints;
167167

@@ -171,24 +171,24 @@ properties::
171171
public $protocols = array('http', 'https', 'ftp', 'ftps');
172172
}
173173

174-
As you can see, a constraint class is fairly minimal. The actual validation is
175-
performed by a another "constraint validator" class. Which constraint
176-
validator is specified by the constraint's ``validatedBy()`` method, which
177-
includes some simple default logic::
174+
Como você pode ver, uma classe de restrição é bem minima. A validação mesmo é
175+
feita por outra classe "validadora de restrições". Que validador de restrição
176+
é especificado pelo método ``validatedBy()``, que inclui alguma lógica simples
177+
por padrão::
178178

179179
// in the base Symfony\Component\Validator\Constraint class
180180
public function validatedBy()
181181
{
182182
return get_class($this).'Validator';
183183
}
184184

185-
Constraint Validators with Dependencies
186-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185+
Validadores de Restrição com Dependencias
186+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187187

188-
If your constraint validator has dependencies, such as a database connection,
189-
it will need to be configured as a service in the dependency injection
190-
container. This service must include the ``validator.constraint_validator``
191-
tag and an ``alias`` attribute:
188+
Se o se validador de restrição tiver dependencias, como conexão com o banco,
189+
ele precisará ser configurado como um serviço no container de dependency injection.
190+
Esse serviço deve incluir a tag ``validator.constraint_validator`` e um atributo
191+
``alias``:
192192

193193
.. configuration-block::
194194

@@ -214,8 +214,7 @@ tag and an ``alias`` attribute:
214214
->addTag('validator.constraint_validator', array('alias' => 'alias_name'))
215215
;
216216
217-
Your constraint class may now use this alias to reference the appropriate
218-
validator::
217+
Suas classes de restrição podem agora usar alias para referenciar o validador apropriado::
219218

220219
public function validatedBy()
221220
{

‎pt_BR/guides/validator/overview.rst

Copy file name to clipboardExpand all lines: pt_BR/guides/validator/overview.rst
+22-22Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
The Validator
2-
=============
1+
O Validator
2+
===========
33

4-
Validation is a very common task in web applications. Data entered in forms
5-
needs to be validated. Data also needs to be validated before it is written
6-
into a database or passed to a web service.
4+
Validação é uma tarefa muito comum em aplicações web. O conteúdo informado
5+
nos formulários precisa ser validado. Esse conteúdo também precisa ser validado
6+
antes de ser gravado em banco de dados ou encaminhado para um web service;
77

8-
Symfony2 ships with a Validator component that makes this task very easy. This
9-
component is based on the `JSR303 Bean Validation specification`_. What? A
10-
Java specification in PHP? You heard right, but it's not as bad as it sounds.
11-
Let's look at how we use it in PHP.
8+
O Symfony2 vem com um componente embarcado chamado Validator, que faz essa
9+
tarefa ser muito simples. Esse componente é baseado na
10+
`JSR303 Bean Validation specification`_. O que?? Uma especificação Java no PHP?
11+
Você ouviu certo, mas não é tão ruim quanto parece. Vamos ver como nós usamos isso
12+
em PHP.
1213

13-
The validator validates objects against :doc:`constraints <constraints>`.
14-
Let's start with the simple constraint that the ``$name`` property of a class
15-
``Author`` must not be empty::
14+
O validator valida os objetos com as :doc:`restrições <constraints>`.
15+
Vamos começar com uma restrição simples que a propriedade ``$name`` da classe
16+
``Author`` não deve ser vazia::
1617

1718
// Application/HelloBundle/Author.php
1819
class Author
1920
{
2021
private $name;
2122
}
2223

23-
The next listing shows the configuration that connects properties of the class
24-
with constraints; this process is called the "mapping":
24+
A próxima lista, mostra a configuração que conecta as propriedades da classe com
25+
as restrições; esse processo é chamado de "mapeamento":
2526

2627
.. configuration-block::
2728

@@ -53,9 +54,9 @@ with constraints; this process is called the "mapping":
5354
private $name;
5455
}
5556
56-
Finally, we can use the :class:`Symfony\\Component\\Validator\\Validator`
57-
class for :doc:`validation <validation>`. To use the default Symfony2
58-
validator, adapt your application configuration as follows:
57+
Finalmente, nós pomos usar a classe :class:`Symfony\\Component\\Validator\\Validator`
58+
para :doc:`validar <validation>`. Para usar a validator padrão do Symfony2, adapte
59+
sua aplicação assim:
5960

6061
.. code-block:: yaml
6162
@@ -64,8 +65,8 @@ validator, adapt your application configuration as follows:
6465
validation:
6566
enabled: true
6667
67-
Now call the ``validate()`` method on the service, which delivers a list of
68-
errors if validation fails.
68+
Agora chame o método ``validate()`` no serviço, que entrega uma lista de erros caso
69+
a validação falhe.
6970

7071
.. code-block:: php
7172
@@ -74,14 +75,13 @@ errors if validation fails.
7475
7576
print $validator->validate($author);
7677
77-
Because the ``$name`` property is empty, you will see the following error
78-
message:
78+
Por a propriedade ``$name`` estar vazia, você vai ver a seguinte mensagem de erro:
7979

8080
.. code-block:: text
8181
8282
Application\HelloBundle\Author.name:
8383
This value should not be blank
8484
85-
Insert a value into the property and the error message will disappear.
85+
Insira um valor na propriedade e a mensagem de erro vai sumir.
8686

8787
.. _JSR303 Bean Validation specification: http://jcp.org/en/jsr/detail?id=303

‎pt_BR/guides/validator/validation.rst

Copy file name to clipboard
+16-17Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
Constraint Validation
2-
=====================
1+
Validação de Restrições
2+
=======================
33

4-
Objects with constraints are validated by the
5-
:class:`Symfony\\Component\\Validator\\Validator` class. If you use Symfony2,
6-
this class is already registered as a service in the Dependency Injection
7-
Container. To enable the service, add the following lines to your
8-
configuration:
4+
Objetos com restrições são validados pela classe
5+
:class:`Symfony\\Component\\Validator\\Validator`. Se você usa o Symfony2, essa
6+
classe já esta registrada como um serviço do Container Dependency Injection.
7+
Para habilitar o serviço, adicione as seguintes linhas na sua configuração:
98

109
.. code-block:: yaml
1110
@@ -14,22 +13,22 @@ configuration:
1413
validation:
1514
enabled: true
1615
17-
Then you can get the validator from the container and start validating your
18-
objects::
16+
Então você pode pegar o validador do container e começar a validar seus
17+
objetos::
1918

2019
$validator = $container->getService('validator');
2120
$author = new Author();
2221

2322
print $validator->validate($author);
2423

25-
The ``validate()`` method returns a
26-
:class:`Symfony\\Component\\Validator\\ConstraintViolationList` object. This
27-
object behaves exactly like an array. You can iterate over it and you can even
28-
print it in a nicely formatted manner. Every element of the list corresponds
29-
to one validation error. If the list is empty, it's time to dance, because
30-
then validation succeeded.
24+
O método ``validate()`` retorna um objeto
25+
:class:`Symfony\\Component\\Validator\\ConstraintViolationList`. Esse objeto
26+
se comporta exatamente como um array. Você pode percorre-lo e até mesmo
27+
imprimi-lo formatado de uma maneira bem agradável. Todo elemento da lista
28+
corresponde a um erro de validação. Se a lista estiver vazia, é hora de dançar,
29+
porque a validação foi bem sucedida.
3130

32-
The above call will output something similar to this:
31+
A chamada assima vai mostrar algo similar a isso:
3332

3433
.. code-block:: text
3534
@@ -40,4 +39,4 @@ The above call will output something similar to this:
4039
Application\HelloBundle\Author.fullName:
4140
This value is too short. It should have 10 characters or more
4241
43-
If you fill the object with correct values the validation errors disappear.
42+
Se o preencher o objeto com os valores corretoes, os erros de validação desaparecem.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.