Drupal add link for maintenance page - drupal-7

I try to add simple link for maintenance page.
So in first place a add "Custom Permissions" module and let all my "contributor" access to the maintenance page ...
But they don't have link ...
In my main module i add this
$items['admin/crisis'] = array(
'title' => 'IsCrisis',
'page callback' => 'drupal_goto',
'page arguments' => array('admin/config/development/maintenance'),
'access arguments' => array('access editor control panel'),
'weight' => 50,
'type' => MENU_NORMAL_ITEM
);
with my administrator account i can see le link ! But contributor account can't ...
How to display this link for contributor ?

The problem which you are facing can be solved by following steps below:
Changing the 'access arguments' to 'administer site configuration'.
Go to {your_domain}/admin/people/permissions and give the 'administer site configuration' permission to the required role who need to access the link 'admin/crisis'.
The user role with permission of 'administer site configuration' can only view this maintenance form.
Note: Only trusted roles can be given this permission.
Thanks

Related

No image is storage on Drupal 7 for user profile

I want to upload the user picture profile in Drupal 7.x but there are some problems when I click on save button on the user profile. After I did it, no file was saved in the default directory and no URL was created
I have overwritten the template file "user-profile-edit.tpl.php" where I create my personal theme. Also before, I add on template.php the code to allow override theme.
$items['user_profile_form'] = array(
'render element' => 'form',
'path' => drupal_get_path('theme', 'MyTheme') . '/templates',
'template' => 'user-profile-edit',
);
return $items;
}
in "edit-profile-edit.tpl.php" I have this
print render($form['picture']['picture_current']);
print render($form['picture']['picture_upload']);
print render($form['picture']['picture_delete']);
$account = user_load(arg(1));
$profile_image= file_create_url($account->picture->uri);
print_r ($user);
print theme('user_picture', array('account' => $user));
When I change the Name or password and save, all the informations are submitted and saved but when I try to upload the image, no image is stored on directory default Drupal and no path image was built.
I activated user to upload it on Administration » Configuration » People » Account settings.
Can someone help me? What I missing or what am I doing wrong?

how use Acl to limit user access

I have same login for 3 different type of users, admin/client/user, everyone has different layout and privileges but the issue is after login every one is able to access all pages. after a lot of search on Google and stack overflow i decided to use Acl. I created tables in database via right procedure recommended by Acl given here AccessControlList. I set permission in following way. But still all type of user are accessing all pages.
$this->Acl->allow(
array('model' => 'User', 'foreign_key' => 1),
'admins'
);
$this->Acl->allow(
array('model' => 'User', 'foreign_key' => 2),
'clients'
);
any help will be appreciated.

Multiple sessions for different instances of Cakephp in the same domain

Did you know that if you run multiple instances of the same application in Cakephp in the same domain, they will share the same Session? For example, suppose you have instances running at:
www.example.com/instance1 and www.example.com/instance2
If you login in the first instance and access instance2, you’ll see that you will already be logged in. This happens because Cakephp, per default, uses the PHP Session storage mechanism.
If this is not the behaviour you expect, Cakephp allows you to choose from three options for the Session handling method: php (default), cake and database. The current method is stored in the Session.save variable in app/config/core.php.
Changing the method from php to cake will make Cakephp store the Session variables in the app/tmp/sessions directory. If you do it, remember to create and give the appropriate permissions to this directory.
Voilá, that’s all you need to do have separate Sessions for each of your Cakephp instances.
Please open the core.php & change the application cookie path then session will be store according to application cookie path
For www.example.com/instance1
Configure::write('Session', array(
'defaults' => 'database',
'ini' => array(
'session.cookie_path' => '/instance1',
),
'cookie' => 'instance1',
'cookieTimeout' => 0,
'checkAgent' => false
));
For www.example.com/instance2
Configure::write('Session', array(
'defaults' => 'database',
'ini' => array(
'session.cookie_path' => '/instance2',
),
'cookie' => 'instance2',
'cookieTimeout' => 0,
'checkAgent' => false
));

need password and confirm password fields in user/register page drupal 7

I am new to drupal. I want the fields(password, confirm password, roles) from admin/people/create to user/register page.
User can create their account with particular role. How can I achieve that when the user register their account.
By help of this code snippets _form();
The Drupal Form API password_confirm element
$form['pass_fields'] = array(
'#type' => 'password_confirm' ,
'#description' => t('Enter the same password in both fields'),
'#size' => 32,
'#required' => TRUE,
);
To check or auto save user role in _form();:
$role = 'user-role';
array( 'roles' => $roles );
you can use this module https://drupal.org/project/autoassignrole
Also if you unchecked option Require e-mail verification when a visitor creates an account. under Home » Administration » Configuration » People
Then you get password and confirm password fields in user registration form.
I created user-register-form.tpl.php with the following code.
<?php print render($form['account']); ?>
<?php print render($form['form_build_id']); ?>
<?php print render($form['form_id']); ?>
<?php print drupal_render($form['actions']); ?>
I unchecked require e-mail verification link. Using profile2_regpath module i checked the role. It is for when the user creates their accounts the role will automatically assign to the user.

Custom non-username/password based login with CakePHP

The jist of this question is about how to override CakePHP's auth component login function to log a user in based on something other than the default username and password.
So, we're developing a custom login function for one of our partners. Basically, the solution provides online courses to a number of companies who want to provide their clients and/or employees with in house training material.
This particular solution takes a home loan account number and personal identification number and does some algorithm validation and logs the user in. Or at least - that's what it should do.
Currently, the auth component tries to user a particular model to compare username and hashed password. Is there anyway to override this particular behaviour and get the Authcomponent to log the user in using the algorithm (glorified regex check) in a custom function? It should completely ignore the need for a username and password. In addition we won't actually have these account numbers and ID numbers stored anywhere. They will each be checked for certain related patterns.
Cheers
Custom your login with authenticate property :
In your appController
public $components = array(
'Session',
'Auth' => array(
'authError' => "You don't have accès",
'authorize' => array('Controller'),
authenticate' => array(
'Form' => array('userModel' => 'MyUserModel',
'fields' => array('username' => 'numberuser','password' => 'personnalId'),
)
)
);

Resources