[SOLVED] Create a session

English! place to talk about development, programming and coding
Post Reply
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

[SOLVED] Create a session

Post by jafumega27 »

Hello,

I'm creating a website to use certain functions of OTRS.
What I want to do is that those who use my website when they are using OTRS functions I'll forwards them to customer page, but when I do it asks the customer to enter the password again. Is there any way the customer does not have to put credentials again?
Last edited by jafumega27 on 01 Jun 2015, 17:00, edited 1 time in total.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Create a session

Post by RStraub »

You might be able to do so with Signle-Sign-On, but I have no experience on that matter.

Another possibility is, to use the OTRS API, create a session for that user and redirect him to the dashboard with the session ID dynamically added to the URL.

So first step, use "CreateSessionID" from this package:
http://otrs.perl-services.de/docs/otrs/ ... ssion.html

then forward him to:

Code: Select all

http://YourURLHere/otrs/customer.pl?Action=CustomerTicketOverview;Subaction=MyTickets&OTRSCustomerInterface=SessionID
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Re: Create a session

Post by jafumega27 »

RStraub wrote:You might be able to do so with Signle-Sign-On, but I have no experience on that matter.

Another possibility is, to use the OTRS API, create a session for that user and redirect him to the dashboard with the session ID dynamically added to the URL.

So first step, use "CreateSessionID" from this package:
http://otrs.perl-services.de/docs/otrs/ ... ssion.html

then forward him to:

Code: Select all

http://YourURLHere/otrs/customer.pl?Action=CustomerTicketOverview;Subaction=MyTickets&OTRSCustomerInterface=SessionID

this is my PHP code for session

Code: Select all

class genericWebservice{
 
private $soapURL = "http://172.X.X.X//otrs/nph-genericinterface.pl/Webservice/GenericTicketConnector/";
private $soapNamespace = "http://www.172.X.X.X.org/TicketConnector/";
private $soapUsername = "XXXXXXXX";
private $soapPass = "YYYYYYY";
private $process, $customerID, $client;
 
public function __construct($process, $customerID, $password){
$this->process = $process;
$this->userID = $customerID;
$this->customerID = $customerID;
$this->password = $password;
}
 
public function testConnection(){
$client = new SoapClient(null, array(
'location'  => $this->soapURL,
'uri'       => $this->soapNamespace,
'trace'     => 1,
'style'     => SOAP_RPC,
'use'       => SOAP_ENCODED));
$this->client = $client;
return $client;
}
 
public function select(){
 
if($this->process == "SessionCreate")
$this->SessionCreate();
else
echo "ERRO Não entrou em SessionCreate"; // for future add on function
}
 
public function SessionCreate(){
	
$SessionID = $this->client->__soapCall('SessionCreate',array(
		new SoapParam($this->customerID, "UserLogin"),
		new SoapParam($this->password, "Password"),
		));
echo var_dump($SessionID);
echo "<br/>";
echo "<br/>";
echo "<br/>";

}
}
?>
but when i try to use it, give me this error, and is a valid user whith a valid password :
You do not have the required permissions to view the files attached to this post.
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Create a session

Post by eandrex »

UserLogin => For Agents
CustomerUserLogin => Customers.

Try changing UserLogin to CustomerUserLogin
jafumega27
Znuny newbie
Posts: 28
Joined: 09 Mar 2015, 14:41
Znuny Version: 4.0.5
Real Name: Tiago Rocha

Re: Create a session

Post by jafumega27 »

eandrex wrote:UserLogin => For Agents
CustomerUserLogin => Customers.

Try changing UserLogin to CustomerUserLogin
Works, Thanks a lot =)
Post Reply