projects
/
osm
/
LW-UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Token length increased to 255
[osm/LW-UI.git]
/
authosm
/
models.py
diff --git
a/authosm/models.py
b/authosm/models.py
index
36a7b1b
..
d03e6d2
100644
(file)
--- a/
authosm/models.py
+++ b/
authosm/models.py
@@
-67,7
+67,7
@@
class AbstractOsmUser(AbstractBaseUser, PermissionsMixin):
current_project = models.CharField(_('project_id'), max_length=255)
psw = models.CharField(_('psw'), max_length=36)
current_project = models.CharField(_('project_id'), max_length=255)
psw = models.CharField(_('psw'), max_length=36)
- token = models.CharField(_('token'), max_length=
36
)
+ token = models.CharField(_('token'), max_length=
255
)
project_id = models.CharField(_('project_id'), max_length=36)
token_expires = models.FloatField(_('token_expires'), max_length=36)
project_id = models.CharField(_('project_id'), max_length=36)
token_expires = models.FloatField(_('token_expires'), max_length=36)
@@
-89,6
+89,14
@@
class AbstractOsmUser(AbstractBaseUser, PermissionsMixin):
return {'id': self.token, 'expires': self.token_expires, 'project_id': self.project_id}
return None
return {'id': self.token, 'expires': self.token_expires, 'project_id': self.project_id}
return None
+ def get_projects(self):
+ client = Client()
+ result = client.get_user_info(self.get_token(), self.username)
+ if 'error' in result and result['error'] is True:
+ return []
+ else:
+ return result['data']['projects']
+
def switch_project(self, project_id):
client = Client()
result = client.switch_project({'project_id': project_id, 'username': self.username, 'password': self.psw})
def switch_project(self, project_id):
client = Client()
result = client.switch_project({'project_id': project_id, 'username': self.username, 'password': self.psw})