summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-18 13:07:19 +0000
committerGerrit Code Review <review@openstack.org>2015-09-18 13:07:19 +0000
commit6e2cd8deffbd60074bf036c1cecdb280f281ccd4 (patch)
treeaf9753d99648b66e61f6067258270084571d3f6b
parentd8041e2c57190c3ba7ec069fc25db0934168c7da (diff)
parent8c64de92f4148d85704b10ea1f7bc441db2ddfee (diff)
downloaddjango_openstack_auth-6e2cd8deffbd60074bf036c1cecdb280f281ccd4.tar.gz
Merge "Replace default User model PK"2.0.0
-rw-r--r--openstack_auth/models.py15
-rw-r--r--openstack_auth/user.py6
2 files changed, 21 insertions, 0 deletions
diff --git a/openstack_auth/models.py b/openstack_auth/models.py
new file mode 100644
index 0000000..76cfc2a
--- /dev/null
+++ b/openstack_auth/models.py
@@ -0,0 +1,15 @@
+# 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.
+
+# import the User model in here so Django can find it
+from openstack_auth.user import User # noqa
diff --git a/openstack_auth/user.py b/openstack_auth/user.py
index 72c8638..dd68b0f 100644
--- a/openstack_auth/user.py
+++ b/openstack_auth/user.py
@@ -16,6 +16,7 @@ import logging
from django.conf import settings
from django.contrib.auth import models
+from django.db import models as db_models
from keystoneclient.common import cms as keystone_cms
from keystoneclient import exceptions as keystone_exceptions
import six
@@ -189,6 +190,10 @@ class User(models.AbstractBaseUser, models.AnonymousUser):
Unscoped Keystone token.
"""
+
+ keystone_user_id = db_models.CharField(primary_key=True, max_length=256)
+ USERNAME_FIELD = 'keystone_user_id'
+
def __init__(self, id=None, token=None, user=None, tenant_id=None,
service_catalog=None, tenant_name=None, roles=None,
authorized_tenants=None, endpoint=None, enabled=False,
@@ -199,6 +204,7 @@ class User(models.AbstractBaseUser, models.AnonymousUser):
self.id = id
self.pk = id
self.token = token
+ self.keystone_user_id = id
self.username = user
self.user_domain_id = user_domain_id
self.user_domain_name = user_domain_name