New Authentication Method (No Permissions after logged in)
Permalink 1 user found helpful
So I've created an LDAP authentication method for 5.7 and got it to login perfectly fine. I pretty much merged things from the concrete method and facebook method until I got something that worked properly. One problem though, when someone logs in, they don't have any admin privledges. I've debugged as much as I could and it shows them logged in and in the administrators group, but concrete5 sees them as an average user.
Below is my authenticate function:
Below is my authenticate function:
public function authenticate() { $post = $this->post(); $this->__ldap_connect(); if (!isset($post['uName']) || !isset($post['uPassword'])) { throw new Exception(t('Please provide both username and password.')); } $uName = $post['uName']; $uPassword = $post['uPassword']; $bindDn = "userid=$uName," . $this->config('ldapdn'); if(!@ldap_bind($this->connection,$bindDn,$uPassword)){ throw new \Exception(t('Invalid username or password.')); } else { $uinf = UserInfo::getByUserName($uName);
Viewing 15 lines of 33 lines. View entire code block.
That worked like a charm, thanks.
Edit: One more thing I noticed,
This part of the authenticate function isn't even going to work (I took this from the concrete auth method). The post array isn't unsetting those indexes if they're blank, it's still sending them along so they are actually set. AKA I can leave both fields blank and it bypasses this IF statement.
It should be something like this,
Edit: One more thing I noticed,
This part of the authenticate function isn't even going to work (I took this from the concrete auth method). The post array isn't unsetting those indexes if they're blank, it's still sending them along so they are actually set. AKA I can leave both fields blank and it bypasses this IF statement.
It should be something like this,
\Session::remove('accessEntities');
I think this should clear the access entities from session, which will then caused them to be refreshed when they're next requested.