Jump to content

site development and user credentials


stelvis
 Share

Recommended Posts

Hi there I'm developing a PW site in conjunction with someone else who is offsite

they are using their own local machine then I'm copying stuff over onto our main dev server via SFTP and phpmyadmin (ie I'm dumping a new copy of the site folder each time and then dropping all tables and importing new ones from his DB export) 

one issue I have run into this way - we have different login credentials setup and these keep getting nuked each time we do this 

is there anyway to maintain the current user credentials and still update the DB and site files?

I can't even find where PW is storing user credentials (especially for the superuser) which would be a start :)

Link to comment
Share on other sites

The user credencials are spread on the db, for instance, the passwords are on the field_pass table, but the permissions are on the field_permissions table. Best way would be to have a PHP script to restore the accounts. Use this method ti build the script http://processwire.com/talk/topic/130-lost-password/?p=931

edit: be careful with where you keep the script, of course, since it will contain all the passwords

  • Like 1
Link to comment
Share on other sites

thanks for the tip

is there any more general info on running 'one shot' scripts within processwire? (a RTFM links is fine here!) 

I take it these are just using some kind of API thats made available somehow?

are there any permissions restrictions on these scripts themselves? (ie do you need to run them from a specified login for example?)

Link to comment
Share on other sites

 is there any more general info on running 'one shot' scripts within processwire? (a RTFM links is fine here!) 

I take it these are just using some kind of API thats made available somehow?

are there any permissions restrictions on these scripts themselves? (ie do you need to run them from a specified login for example?)

You can use scripts in commandline mode or in HTTP environment that include the pw index.php like this for example:

// the absolute path or relative path to processwires index.php
	$PATH2PWindex = dirname(__FILE__).'/index.php';

// $username and $pass to a superuser
	$PWuser = '';
	$PWpass = '';

// ...

require_once($PATH2PWindex);

wire('session')->login($PWuser,$PWpass);
if(!wire('user')->active || !wire('user')->hasRole('superuser')) {
	echo "\n\nERROR: Incorrect UserLogin!\n\nScript stop now!\n";
	exit(1);
}

after that you are logged in as superuser and can do all API stuff you like.

I use this above as external CLI-Script and ask for credentials in shell window.

You have to access the API via wire('pages'), wire('session'), etc instead of $pages or $session.

http://processwire.com/api/include/

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...