Created
January 21, 2015 10:59
-
-
Save rfos/7c340224cd14fd4e126d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="background-image:url(images/banner-interno.jpg); background-position:top center; background-repeat:no-repeat; height:160px;"> | |
</div> | |
<!-- Contents Start --> | |
<div class="contents"> | |
<div class="custom-container"> | |
<div class="row"> | |
<!-- Content Column Start --> | |
<div class="col-lg-9 col-md-12 col-sm-12 col-xs-12 equalcol conentsection"> | |
<div class="sections"> | |
<h1>Novo Site! Tudo Novo...</h1> | |
</div> | |
<div class="clearfix"></div> | |
<div class="sections"> | |
<br> | |
<p>Estamos reformulando um Novo Site e queremos que você continue usufruindo do melhor conteúdo erótico da Internet. Para os assinantes antigos estamos refazendo o cadastro com intuito de atualização de dados de assinantes para o novo site que estamos desenvolvendo e que, em breve estará no ar com muitas novidades, novos recursos e com o melhor conteúdo exclusivo da Internet.</p> | |
<p>Para os <strong>Assinantes Mensais</strong>, além do recadastramento, você deverá informar sua forma de pagamento e os dados de cobrança. Não se preocupe! Sua assinatura anterior está cancelada.</p> | |
<p>Para os <strong>Assinantes Trimestrais, Semestrais ou Anuais</strong>, também deverão realizar o recadastro e atualizar suas informações de cobrança obrigatoriamente para continuar usufruindo do acesso à Memória Digital com conteúdo exclusivo. Os créditos referente aos meses pagos e não utilizados, serão revertidos na mesma proporção, em períodos de utilização para o novo site.</p> | |
<br> | |
<h2>Preencha o Formulário abaixo e siga as instruções a seguir:</h2> | |
<div class="clearfix"></div> | |
</div> | |
<div class="clearfix"></div> | |
<?php echo $this->Session->flash(); ?> | |
<div class="sections box_form"> | |
<div class="clearfix"></div> | |
<div id="leavereply"> | |
<?php echo $this->Form->create('User', array('action'=>'cadastro')); ?> | |
<div class="row"> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Nome Completo</label> | |
<?php echo $this->Form->input('nome', array('label' => false,'class' => 'form-control','placeholder'=>'Informe seu Nome Completo', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Data de nascimento</label> | |
<?php echo $this->Form->input('DtNascimento', array('label' => false,'class' => 'form-control','data-mask' => '99/99/9999','placeholder'=>'Informe sua Data de nascimento', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>CPF</label> | |
<?php echo $this->Form->input('cpf', array('label' => false,'class' => 'form-control','data-mask' => '999.999.999-99', 'placeholder'=>'Informe sua Data de nascimento', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>E-mail</label> | |
<?php echo $this->Form->input('email', array('type'=>'email', 'label' => false,'class' => 'form-control','placeholder'=>'Informe seu Email', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Telefone</label> | |
<?php echo $this->Form->input('telefone', array('label' => false,'class' => 'form-control','data-mask' => '(99)9999-9999','placeholder'=>'Informe seu Telefone', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Celular</label> | |
<?php echo $this->Form->input('Celular', array('label' => false,'class' => 'form-control','data-mask' => '(99)99999-9999','placeholder'=>'Informe seu Celular', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Endereço</label> | |
<?php echo $this->Form->input('endereco', array('label' => false,'class' => 'form-control','placeholder'=>'Informe seu Endereço', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Número</label> | |
<?php echo $this->Form->input('numero', array('label' => false,'class' => 'form-control','placeholder'=>'Informe seu Número', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>CEP</label> | |
<?php echo $this->Form->input('cep', array('label' => false,'class' => 'form-control','placeholder'=>'Informe seu CEP', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Bairro</label> | |
<?php echo $this->Form->input('bairro', array('label' => false,'class' => 'form-control','placeholder'=>'Informe seu Bairro', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Cidade</label> | |
<?php echo $this->Form->input('cidade', array('label' => false,'class' => 'form-control','placeholder'=>'Informe sua Cidade', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<?php | |
$Estado = array( | |
'AC'=>'Acre', | |
'AL'=>'Alagoas', | |
'AM'=>'Amazonas', | |
'AP'=>'Amapá', | |
'BA'=>'Bahia', | |
'CE'=>'Ceará', | |
'DF'=>'Distrito Federal', | |
'ES'=>'Espirito Santo', | |
'GO'=>'Goiás', | |
'MA'=>'Maranhão', | |
'MG'=>'Minas Gerais', | |
'MS'=>'Mato Grosso do Sul', | |
'MT'=>'Mato Grosso', | |
'PA'=>'Pará', | |
'PB'=>'Paraíba', | |
'PE'=>'Pernambuco', | |
'PI'=>'Piauí', | |
'PR'=>'Paraná', | |
'RJ'=>'Rio de Janeiro', | |
'RN'=>'Rio Grande do Norte', | |
'RO'=>'Rondônia', | |
'RR'=>'Roraima', | |
'RS'=>'Rio Grande do Sul', | |
'SC'=>'Santa Catarina', | |
'SE'=>'Sergipe', | |
'SP'=>'São Paulo', | |
'TO'=>'Tocantins', | |
); | |
?> | |
<?php echo $this->Form->input('uf', array('class'=>'form-control', 'options'=>$Estado, 'empty' => '(Escolha o Estado)', 'required'=>'false')) ?> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Usuário</label> | |
<?php echo $this->Form->input('username', array('label' => false,'class' => 'form-control','placeholder'=>'Informe um novo usuário', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> | |
<div class="form-group"> | |
<label>Senha</label> | |
<?php echo $this->Form->input('password', array('type'=>'password', 'label' => false,'class' => 'form-control','placeholder'=>'Informe uma nova senha', 'div'=>false, 'required'=>'false' ))?> | |
</div> | |
</div> | |
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> | |
<?php echo $this->Form->button('Enviar meu Cadastro', array('type' => 'submit', 'class'=>'btn btn-primary backcolor-blue')) ?> | |
</div> | |
</form> | |
</div> | |
</div> | |
<p><strong>Dúvidas ou Sugestões?</strong> - <a href="/contato">Clique Aqui</a> para enviar sua dúvida, reclamação ou sugestão para nosso Atendimento. <strong>DreamCam Club</strong></p> | |
</div> | |
<!-- Content Column End --> | |
</div> | |
<!-- Gray Sidebar Start --> | |
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 equalcol graysidebar"> | |
<!-- Comments Widget start --> | |
<div class="widget"> | |
<h2 class="heading" style="color:#fff;">Faça sua assinatura</h2> | |
<div class="commentslist"> | |
<ul> | |
<li> | |
<p>Você ainda não é assinante? Então faça agora mesmo sua assinatura para ter acesso ao melhor conteúdo e receba um desconto especial para a inauguração do novo site!</p><br> | |
<p align="center" class="titulo">Videos inéditos, por apenas<br> | |
<span class="preco">R$ 12,90/ mês</span></p> | |
<div align="center"> | |
<img src="images/banner-memoria.png"> | |
<button type="button" class="btn btn-primary backcolor-green">Faça sua Assinatura</button> | |
</div> | |
</li> | |
</ul> | |
</div> | |
</div> | |
<div class="clearfix"></div> | |
</div> | |
<!-- Gray Sidebar End --> | |
</div> | |
</div> | |
</div> | |
<!-- Contents End --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('AppModel', 'Model'); | |
App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth'); | |
App::uses('AuthComponent', 'Controller/Component'); | |
App::uses('CakeEmail', 'Network/Email'); | |
/** | |
* User Model | |
* | |
*/ | |
class User extends AppModel { | |
public $belongsTo = array('Group'); | |
public $actsAs = array('Acl' => array('type' => 'requester', 'enabled' => false)); | |
public function parentNode() { | |
if (!$this->id && empty($this->data)) { | |
return null; | |
} | |
if (isset($this->data['User']['group_id'])) { | |
$groupId = $this->data['User']['group_id']; | |
} else { | |
$groupId = $this->field('group_id'); | |
} | |
if (!$groupId) { | |
return null; | |
} | |
return array('Group' => array('id' => $groupId)); | |
} | |
public function bindNode($user) { | |
return array('model' => 'Group', 'foreign_key' => $user['User']['group_id']); | |
} | |
// Validação do formulário | |
public $validate = array( | |
'username' => array( | |
'nonEmpty' => array( | |
'rule' => array('notEmpty'), | |
'message' => 'A username is required', | |
'allowEmpty' => false | |
), | |
'between' => array( | |
'rule' => array('between', 5, 15), | |
'required' => true, | |
'message' => 'Usernames must be between 5 to 15 characters' | |
), | |
'unique' => array( | |
'rule' => array('isUniqueUsername'), | |
'message' => 'Este nome de usuárioi já existe, por favor escolha outro nome de usuário.', | |
'on' => 'create' | |
), | |
'alphaNumericDashUnderscore' => array( | |
'rule' => array('alphaNumericDashUnderscore'), | |
'message' => 'O nome de usuário deve contar letrar, números e underscore (traço baixo)', | |
'on' => 'create' | |
), | |
), | |
'password' => array( | |
'notEmpty' => array( | |
'rule' => array('notEmpty'), | |
'message' => 'Campo obrigatório', | |
'allowEmpty' => false, | |
'required' => true, | |
//'last' => false, // Stop validation after this rule | |
'on' => 'create', // Limit validation to 'create' or 'update' operations | |
), | |
), | |
'nome' => array( | |
'notEmpty' => array( | |
'rule' => array('notEmpty'), | |
'message' => 'Campo obrigatório', | |
'allowEmpty' => false, | |
'required' => true, | |
), | |
), | |
'cpf' => array( | |
'validaCPF' => array( | |
'rule' => array('validaCPF'), | |
'message' => 'O CPF informado não é válido.' | |
), | |
'unique' => array( | |
'rule' => 'isUnique', | |
'required' => 'create', | |
'message' => 'O CPF informado já consta em nosso sistema.', | |
'on' => 'create' | |
), | |
'notEmpty' => array( | |
'rule' => 'notEmpty', | |
'message' => 'O campo CPF obrigatório.' | |
) | |
), | |
// 'DtNascimento' => array( | |
// 'required' => array( | |
// 'message' => 'Informe a data de nascimento (DD/MM/AAAA).', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'endereco' => array( | |
// 'required' => array( | |
// 'message' => 'Campo obrigatório', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'numero' => array( | |
// 'required' => array( | |
// 'message' => 'Campo obrigatório', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'cep' => array( | |
// 'required' => array( | |
// 'message' => 'Campo obrigatório', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'bairro' => array( | |
// 'required' => array( | |
// 'message' => 'Campo obrigatório', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'cidade' => array( | |
// 'required' => array( | |
// 'message' => 'Campo obrigatório', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
// 'uf' => array( | |
// 'required' => array( | |
// 'message' => 'Selecione o seu Estado', | |
// 'allowEmpty' => false, | |
// 'required' => true, | |
// ), | |
// ), | |
'email' => array( | |
'required' => array( | |
'rule' => array('email', true), | |
'message' => 'O endereço de email é obrigatório.', | |
'allowEmpty' => false, | |
'required' => true, | |
), | |
'unique' => array( | |
'rule' => array('isUniqueEmail'), | |
'message' => 'Este endereço de email já está cadastrado', | |
'allowEmpty' => false, | |
'required' => true, | |
'on' => 'create' | |
), | |
'between' => array( | |
'rule' => array('between', 6, 60), | |
'message' => 'Nome de usuário de ter no mínimo 6 caracteres.', | |
'allowEmpty' => false, | |
'required' => true, | |
) | |
), | |
); | |
/** | |
* Verifica o CPF | |
* | |
* @return boolean | |
**/ | |
public function validaCPF() | |
{ | |
$cpf = $this->data['User']['cpf']; | |
if(empty($cpf)) | |
{ | |
return false; | |
} | |
$cpf = ereg_replace('[^0-9]', '', $cpf); | |
$cpf = str_pad($cpf, 11, '0', STR_PAD_LEFT); | |
if (strlen($cpf) != 11) | |
{ | |
return false; | |
} else if ($cpf == '00000000000' || | |
$cpf == '11111111111' || | |
$cpf == '22222222222' || | |
$cpf == '33333333333' || | |
$cpf == '44444444444' || | |
$cpf == '55555555555' || | |
$cpf == '66666666666' || | |
$cpf == '77777777777' || | |
$cpf == '88888888888' || | |
$cpf == '99999999999') { | |
return false; | |
} | |
else | |
{ | |
for ($t = 9; $t < 11; $t++) { | |
for ($d = 0, $c = 0; $c < $t; $c++) | |
{ | |
$d += $cpf{$c} * (($t + 1) - $c); | |
} | |
$d = ((10 * $d) % 11) % 10; | |
if ($cpf{$c} != $d) | |
{ | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
/** | |
* Before isUniqueUsername | |
* @param array $options | |
* @return boolean | |
*/ | |
function isUniqueUsername($check) { | |
$username = $this->find( | |
'all', | |
array( | |
'fields' => array( | |
'User.id', | |
'User.username' | |
), | |
'conditions' => array( | |
'User.username' => $check['username'] | |
) | |
) | |
); | |
if(!empty($username)){ | |
if($this->data[$this->alias]['username'] == $username){ | |
return true; | |
}else{ | |
return false; | |
} | |
}else{ | |
return true; | |
} | |
} | |
/** | |
* Before isUniqueEmail | |
* @param array $options | |
* @return boolean | |
*/ | |
function isUniqueEmail($check) { | |
$email = $this->find( | |
'first', | |
array( | |
'fields' => array( | |
'User.id', | |
'User.email' | |
), | |
'conditions' => array( | |
'User.email' => $check['email'] | |
) | |
) | |
); | |
if(!empty($email)){ | |
if($this->data[$this->alias]['email'] == $email['User']['email']){ | |
return true; | |
}else{ | |
return false; | |
} | |
}else{ | |
return true; | |
} | |
} | |
public function alphaNumericDashUnderscore($check) { | |
// $data array is passed using the form field name as the key | |
// have to extract the value to make the function generic | |
$value = array_values($check); | |
$value = $value[0]; | |
return preg_match('/^[a-zA-Z0-9_ \-]*$/', $value); | |
} | |
public function equaltofield($check,$otherfield) | |
{ | |
//get name of field | |
$fname = ''; | |
foreach ($check as $key => $value){ | |
$fname = $key; | |
break; | |
} | |
return $this->data[$this->name][$otherfield] === $this->data[$this->name][$fname]; | |
} | |
// Utiliza o componente Blowfish para Hash de segurança das senhas | |
public function beforeSave($options = array()) { | |
if (!empty($this->data[$this->alias]['password'])) { | |
$passwordHasher = new BlowfishPasswordHasher(); | |
$this->data[$this->alias]['password'] = $passwordHasher->hash($this->data[$this->alias]['password']); | |
} | |
return true; | |
} | |
public function afterSave($created,$options = array()) | |
{ | |
if(AuthComponent::user()) | |
{ | |
CakeSession::write('Auth.User',(array_replace(CakeSession::read('Auth.User'), $this->data['User']))); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('AppController', 'Controller'); | |
/** | |
* Users Controller | |
* | |
* @property User $User | |
* @property PaginatorComponent $Paginator | |
*/ | |
class UsersController extends AppController { | |
public $name = 'Users'; | |
public $uses = array('User', 'Group'); | |
/** | |
* Components | |
* | |
*/ | |
public function beforeFilter() { | |
parent::beforeFilter(); | |
$this->Auth->allow('initDB', 'cadastro', 'logout', 'login', 'validarEmail'); | |
} | |
/** | |
* Components | |
* | |
* @var array | |
*/ | |
public $components = array('Paginator'); | |
/** | |
* index method | |
* | |
* @return void | |
*/ | |
public function index() { | |
$this->User->recursive = 0; | |
$this->set('users', $this->Paginator->paginate()); | |
} | |
/** | |
* view method | |
* | |
* @throws NotFoundException | |
* @param string $id | |
* @return void | |
*/ | |
public function view($id = null) { | |
if (!$this->User->exists($id)) { | |
throw new NotFoundException(__('Invalid user')); | |
} | |
$options = array('conditions' => array('User.' . $this->User->primaryKey => $id)); | |
$this->set('user', $this->User->find('first', $options)); | |
} | |
/** | |
* edit method | |
* | |
* @throws NotFoundException | |
* @param string $id | |
* @return void | |
*/ | |
public function edit($id = null) { | |
if (!$this->User->exists($id)) { | |
throw new NotFoundException(__('Invalid user')); | |
} | |
if ($this->request->is(array('post', 'put'))) { | |
if ($this->User->save($this->request->data)) { | |
$this->Session->setFlash(__('The user has been saved.')); | |
return $this->redirect(array('action' => 'index')); | |
} else { | |
$this->Session->setFlash(__('The user could not be saved. Please, try again.')); | |
} | |
} else { | |
$options = array('conditions' => array('User.' . $this->User->primaryKey => $id)); | |
$this->request->data = $this->User->find('first', $options); | |
} | |
} | |
/** | |
* login method | |
* | |
* @throws NotFoundException | |
* @param string $id | |
* @return void | |
*/ | |
public function login() { | |
if ($this->Auth->login()) { | |
$this->redirect($this->Auth->redirectUrl()); | |
} else { | |
$this->Session->setFlash(__('<p class="alert alert-warning">Usuário ou senha inválidos, tente novamente.</p>')); | |
} | |
} | |
public function admin_login() { | |
$this->render('admin_login'); | |
if ($this->request->is('post')) { | |
if ($this->Auth->login()) { | |
return $this->redirect($this->Auth->redirectUrl()); | |
} | |
$this->Session->setFlash(__('Invalid username or password, try again')); | |
} | |
} | |
/** | |
* cadastro method | |
* @return void | |
*/ | |
public function cadastro() | |
{ | |
if ($this->request->is('post')) { | |
$this->request->data['User']['codigo'] = String::uuid(); | |
$this->request->data['User']['group_id'] = '2'; | |
$this->request->data['User']['role'] = 'user'; | |
if ($this->User->save($this->request->data)) { | |
// Define mensagem de alerta ao usuário informando que ele receberá o email de confirmação | |
$this->Session->setFlash( | |
'<strong><p>Um e-mail de confirmação será enviado contendo um link/código para a validação do mesmo.</p> | |
Somente após a confirmação do seu e-mail você estará apto fazer login em nosso sitema. | |
</p></strong>', | |
'default', | |
array( | |
'titulo' => 'Cadastro realizado com sucesso!', | |
'class' => 'alert alert-success' | |
) | |
); | |
// Armazena informações do formulário | |
$user = $this->User->read(); | |
// Envia email | |
$email = new CakeEmail(); | |
$email->config('smtp'); | |
// Template do email em /View/Emails/html/cadastro.ctp | |
$email->template('cadastro'); | |
$email->to($user['User']['email']); | |
$email->emailFormat('html'); | |
$email->viewVars($this->User->read()); | |
$email->send(); | |
// Após envio do email redireciona usuário para página | |
$this->redirect(array('controller' => 'inicio', 'action' => 'index')); | |
} | |
} | |
} | |
/** | |
* Função para confirmar email do assinante | |
* @param $id | |
* @param $codigo | |
*/ | |
public function validarEmail($id,$codigo) | |
{ | |
$count = $this->User->find('count', array('conditions' => array('User.id =' => $id,'User.codigo =' => $codigo))); | |
if($count) | |
{ | |
$this->User->id = $id; | |
$this->User->set('status','1'); | |
$this->User->set('ativacao','1'); | |
$this->User->set('codigo','0'); | |
$data = $this->User->save(); | |
if($this->Auth->login($data['User'])) | |
{ | |
$this->Session->setFlash( | |
'<p><strong>Seja bem vindo, '.Inflector::humanize(AuthComponent::user('nome')).'!<br><br></strong></p>', | |
'default', | |
array('titulo' => 'Login efetuado com sucesso!','class' => 'alert alert-success'),'auth'); | |
$this->redirect(array('controller' => 'memoria-digital', 'action' => 'welcome')); | |
} | |
} | |
else | |
{ | |
$this->Session->setFlash( | |
'<p><strong>Link informado já foi utilizado ou está incorreto.</strong></p>', | |
'default', | |
array( | |
'titulo' => 'Cadastro realizado com sucesso!', | |
'class' => 'alert alert-warning' | |
) | |
); | |
$this->redirect(array('controller' => 'Inicio', 'action' => 'index')); | |
} | |
} | |
/** | |
* Logout | |
*/ | |
public function logout() { | |
return $this->redirect($this->Auth->logout()); | |
} | |
public function initDB() { | |
$group = $this->User->Group; | |
// Allow admins to everything | |
$group->id = 1; | |
$this->Acl->allow($group, 'controllers'); | |
// allow users to only view videos | |
$group->id = 2; | |
$this->Acl->deny($group, 'controllers'); | |
$this->Acl->deny($group, 'controllers/User/add'); | |
$this->Acl->deny($group, 'controllers/User/edit'); | |
$this->Acl->deny($group, 'controllers/Videos/add'); | |
$this->Acl->deny($group, 'controllers/Videos/edit'); | |
$this->Acl->allow($group, 'controllers/Videos/view'); | |
// allow basic users to log out | |
$this->Acl->allow($group, 'controllers/users/logout'); | |
// we add an exit to avoid an ugly "missing views" error message | |
echo "all done"; | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment