fix oauth app creation bug

This commit is contained in:
Nicolas Le Goff
2012-02-22 16:55:50 +01:00
parent 35d6d86756
commit 33b225a290
6 changed files with 179 additions and 167 deletions

View File

@@ -51,6 +51,14 @@ class API_OAuth2_Form_DevAppDesktop
*/
public $callback;
/**
*
* @var string
*/
public $type;
public $scheme_website;
public $urlwebsite;
/**
*
* @param Request $request
@@ -58,10 +66,14 @@ class API_OAuth2_Form_DevAppDesktop
*/
public function __construct(Request $request)
{
$this->name = $request->get('name', null);
$this->description = $request->get('description', null);
$this->website = $request->get('website', null);
$this->callback = $request->get('callback', null);
$this->name = $request->get('name', '');
$this->description = $request->get('description', '');
$this->scheme_website = $request->get('scheme-website', 'http://');
$this->website = $request->get('website', '');
$this->callback = API_OAuth2_Application::NATIVE_APP_REDIRECT_URI;
$this->type = API_OAuth2_Application::DESKTOP_TYPE;
$this->urlwebsite = $this->scheme_website . $this->website;
return $this;
}
@@ -75,18 +87,6 @@ class API_OAuth2_Form_DevAppDesktop
return $this->name;
}
/**
*
* @param string $callback
* @return API_OAuth2_Form_DevApp
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
*
* @return string
@@ -96,18 +96,6 @@ class API_OAuth2_Form_DevAppDesktop
return $this->description;
}
/**
*
* @param string $callback
* @return API_OAuth2_Form_DevApp
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
*
* @return string
@@ -117,18 +105,6 @@ class API_OAuth2_Form_DevAppDesktop
return $this->website;
}
/**
*
* @param string $callback
* @return API_OAuth2_Form_DevApp
*/
public function setWebsite($website)
{
$this->website = $website;
return $this;
}
/**
*
* @return string
@@ -140,17 +116,29 @@ class API_OAuth2_Form_DevAppDesktop
/**
*
* @param string $callback
* @return API_OAuth2_Form_DevApp
* @return string
*/
public function setCallback($callback)
public function getType()
{
$this->callback = $callback;
return $this;
return $this->type;
}
/**
public function getSchemeWebsite()
{
return $this->scheme_website;
}
public function getUrlwebsite()
{
return $this->urlwebsite;
}
public function getSchemeCallback()
{
return '';
}
/**
*
* @param ClassMetadata $metadata
* @return API_OAuth2_Form_DevApp
@@ -162,8 +150,8 @@ class API_OAuth2_Form_DevAppDesktop
$metadata->addPropertyConstraint('name', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('description', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('website', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('website', new Constraints\Url($url));
$metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank($blank));
$metadata->addPropertyConstraint('urlwebsite', new Constraints\Url($url));
return;
}