Skip to content

Commit

Permalink
LDAP: fix again proper check if groups are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzz committed Oct 24, 2012
1 parent 53ae742 commit 4b39ce5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/user_ldap/group_ldap.php
Expand Up @@ -28,7 +28,9 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {

public function setConnector(lib\Connection &$connection) {
parent::setConnector($connection);
if(!empty($this->connection->ldapGroupFilter) && !empty($this->connection->ldapGroupMemberAssocAttr)) {
$filter = $this->connection->ldapGroupFilter;
$gassoc = $this->connection->ldapGroupMemberAssocAttr;
if(!empty($filter) && !empty($gassoc)) {
$this->enabled = true;
}
}
Expand Down

7 comments on commit 4b39ce5

@diederikdehaas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it me or is this the exact same code just formatted differently?

@blizzz
Copy link
Contributor Author

@blizzz blizzz commented on 4b39ce5 Oct 24, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diederikdehaas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, didn't know that.
I'll learn php first before making another comment ;-)

@blizzz
Copy link
Contributor Author

@blizzz blizzz commented on 4b39ce5 Oct 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's fine, it's a good way to learn and understand.

@tanghus
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH one can never come to understand PHP, but possibly get to know most of it's quirks ;)

@diederikdehaas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL. That and some other 'reports' on the internet kept me from diving in it. Probably should just bite the bullet.

@VicDeo
Copy link
Member

@VicDeo VicDeo commented on 4b39ce5 Oct 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://www.php.net/manual/en/function.empty.php
"empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false."

If both members are either strings or NULL it can be omitted for implicit type cast:
if($this->connection->ldapGroupFilter && $this->connection->ldapGroupMemberAssocAttr) {

Please sign in to comment.