Commit ae96ec49 authored by Pål Karlsrud's avatar Pål Karlsrud

Only allow people how are part of some project to access the service.

parent 55fa1d4a
......@@ -7,6 +7,7 @@ use OCP\ISession;
use \OCP\IUserManager;
use \OCP\IGroupManager;
use \OCP\IUserSession;
use OC\User\LoginException;
class UserHooks {
......@@ -24,7 +25,8 @@ class UserHooks {
public function register() {
$callback = function($user) {
$groups = $this->fetchGroups($this->session->get('oauth_access_token'));
if (!is_array($groups)) return;
if (!is_array($groups)) throw new LoginException("Failed to fetch MAS projects.");
if (empty($groups)) throw new LoginException("You must be member of a MAS project in order to use this service.");
// If a group the user is part of does not exist, create it,
// otherwise register them as members.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment