Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Merge branch 'release/1.16.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Retterer committed Jul 20, 2016
2 parents 28807c0 + 0398116 commit 7b0da3d
Show file tree
Hide file tree
Showing 32 changed files with 2,276 additions and 12 deletions.
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ stormpath-sdk-php Changelog
===========================


Version 1.16.0
--------------

Released on July 20, 2016

- Fix cache key for resources
- Adds method for getting access to the password modified at property off account
- Work with Password Policy from Directory
- Password Reuse policy
- Adds ability to work with all email templates
- Now able to add an account directly from the organization resource
- Create and work with email blacklist and whitelist.
- Request ID now part of the resource error and error
- Name and Description can be added to API Keys

Version 1.15.0
--------------

Expand Down
3 changes: 3 additions & 0 deletions src/Cache/PSR6CacheKeyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ protected function createCacheKey($href, $query = null, $options = [])
{
if (is_array($query)) {
ksort($query);
foreach ($query as $key => $value) {
$query[$key] = (string) $value;
}
$query = http_build_query($query);
}
$key = $href.'?'.$query;
Expand Down
3 changes: 2 additions & 1 deletion src/DataStore/DefaultDataStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,14 @@ private function toStdClass(Resource $resource, $customData = false)
$property = $resource->getProperty($name);

$nameIsCustomData = $name == CustomData::CUSTOMDATA_PROP_NAME;
$nameIsDefaultModel = $name == 'defaultModel';

if ($property instanceof \Stormpath\Resource\CustomData)
{
$property = $this->toStdClass($property, true);
}

else if ($property instanceof \stdClass && $customData === false && !$nameIsCustomData)
else if ($property instanceof \stdClass && $customData === false && !$nameIsCustomData && !$nameIsDefaultModel)
{
$property = $this->toSimpleReference($name, $property);
}
Expand Down
87 changes: 87 additions & 0 deletions src/Directory/PasswordPolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

/*
* Copyright 2016 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Stormpath\Directory;

use Stormpath\Client;
use Stormpath\Resource\InstanceResource;
use Stormpath\Stormpath;

class PasswordPolicy extends InstanceResource
{
const RESET_TOKEN_TTL = "resetTokenTtl";
const PASSWORD_STRENGTH = "strength";
const RESET_EMAIL_STATUS = "resetEmailStatus";
const RESET_EMAIL_TEMPLATES = "resetEmailTemplates";
const RESET_SUCCESS_EMAIL_STATUS = "resetSuccessEmailStatus";
const RESET_SUCCESS_EMAIL_TEMPLATES = "resetSuccessEmailTemplates";

const PATH = 'passwordPolicies';

public static function get($href, array $options = [])
{
return Client::get($href, Stormpath::PASSWORD_POLICY, self::PATH, $options);
}

public function getResetTokenTtl()
{
return $this->getProperty(self::RESET_TOKEN_TTL);
}

public function setResetTokenTtl($ttl)
{
$this->setProperty(self::RESET_TOKEN_TTL, $ttl);
}

public function getResetEmailStatus()
{
return $this->getProperty(self::RESET_EMAIL_STATUS);
}

public function setResetEmailStatus($ttl)
{
$this->setProperty(self::RESET_EMAIL_STATUS, $ttl);
}

public function getResetSuccessEmailStatus()
{
return $this->getProperty(self::RESET_EMAIL_STATUS);
}

public function setResetSuccessEmailStatus($ttl)
{
$this->setProperty(self::RESET_EMAIL_STATUS, $ttl);
}

public function getStrength(array $options = [])
{
return $this->getResourceProperty(self::PASSWORD_STRENGTH, Stormpath::PASSWORD_STRENGTH, $options);
}

public function getResetEmailTemplates(array $options = [])
{
return $this->getResourceProperty(self::RESET_EMAIL_TEMPLATES, Stormpath::MODELED_EMAIL_TEMPLATE_LIST, $options);
}

public function getResetSuccessEmailTemplates(array $options = [])
{
return $this->getResourceProperty(self::RESET_SUCCESS_EMAIL_TEMPLATES, Stormpath::UNMODELED_EMAIL_TEMPLATE_LIST, $options);
}


}
237 changes: 237 additions & 0 deletions src/Directory/PasswordStrength.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
<?php
/*
* Copyright 2016 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Stormpath\Directory;

use Stormpath\Client;
use Stormpath\Resource\InstanceResource;
use Stormpath\Stormpath;

class PasswordStrength extends InstanceResource
{
const HREF = "href";
const MIN_LENGTH = "minLength";
const MAX_LENGTH = "maxLength";
const MIN_NUMERIC = "minNumeric";
const MIN_SYMBOL = "minSymbol";
const MIN_DIACRITIC = "minDiacritic";
const PREVENT_REUSE = "preventReuse";
const MIN_LOWER_CASE = "minLowerCase";
const MIN_UPPER_CASE = "minUpperCase";

const PATH = "strength";


public static function get($href, array $options = [])
{
return Client::get($href, Stormpath::PASSWORD_STRENGTH, self::PATH, $options);
}
/**
* Gets the href property
*
* @return string
*/
public function getHref()
{
return $this->getProperty(self::HREF);
}
/**
* Gets the minLength property
*
* @return integer
*/
public function getMinLength()
{
return $this->getProperty(self::MIN_LENGTH);
}

/**
* Sets the minLength property
*
* @param integer $minLength The minLength of the object
* @return self
*/
public function setMinLength($minLength)
{
$this->setProperty(self::MIN_LENGTH, $minLength);

return $this;
}


/**
* Gets the maxLength property
*
* @return integer
*/
public function getMaxLength()
{
return $this->getProperty(self::MAX_LENGTH);
}

/**
* Sets the maxLength property
*
* @param integer $maxLength The maxLength of the object
* @return self
*/
public function setMaxLength($maxLength)
{
$this->setProperty(self::MAX_LENGTH, $maxLength);

return $this;
}

/**
* Gets the minLowerCase property
*
* @return integer
*/
public function getMinLowerCase()
{
return $this->getProperty(self::MIN_LOWER_CASE);
}

/**
* Sets the minLowerCase property
*
* @param integer $minLowerCase The minLowerCase of the object
* @return self
*/
public function setMinLowerCase($minLowerCase)
{
$this->setProperty(self::MIN_LOWER_CASE, $minLowerCase);

return $this;
}

/**
* Gets the minUpperCase property
*
* @return integer
*/
public function getMinUpperCase()
{
return $this->getProperty(self::MIN_UPPER_CASE);
}

/**
* Sets the minUpperCase property
*
* @param integer $minUpperCase The minUpperCase of the object
* @return self
*/
public function setMinUpperCase($minUpperCase)
{
$this->setProperty(self::MIN_UPPER_CASE, $minUpperCase);

return $this;
}

/**
* Gets the minNumeric property
*
* @return integer
*/
public function getMinNumeric()
{
return $this->getProperty(self::MIN_NUMERIC);
}

/**
* Sets the minNumeric property
*
* @param integer $minNumeric The minNumeric of the object
* @return self
*/
public function setMinNumeric($minNumeric)
{
$this->setProperty(self::MIN_NUMERIC, $minNumeric);

return $this;
}

/**
* Gets the minSymbol property
*
* @return integer
*/
public function getMinSymbol()
{
return $this->getProperty(self::MIN_SYMBOL);
}

/**
* Sets the minSymbol property
*
* @param integer $minSymbol The minSymbol of the object
* @return self
*/
public function setMinSymbol($minSymbol)
{
$this->setProperty(self::MIN_SYMBOL, $minSymbol);

return $this;
}

/**
* Gets the minDiacritic property
*
* @return integer
*/
public function getMinDiacritic()
{
return $this->getProperty(self::MIN_DIACRITIC);
}

/**
* Sets the minDiacritic property
*
* @param integer $minDiacritic The minDiacritic of the object
* @return self
*/
public function setMinDiacritic($minDiacritic)
{
$this->setProperty(self::MIN_DIACRITIC, $minDiacritic);

return $this;
}

/**
* Gets the preventReuse property
*
* @return integer
*/
public function getPreventReuse()
{
return $this->getProperty(self::PREVENT_REUSE);
}

/**
* Sets the preventReuse property
*
* @param integer $preventReuse The preventReuse of the object
* @return self
*/
public function setPreventReuse($preventReuse)
{
$this->setProperty(self::PREVENT_REUSE, $preventReuse);

return $this;
}

}
Loading

0 comments on commit 7b0da3d

Please sign in to comment.