work in progress: create external (zitadel) users: prepare for testing, start implementation in loops.organize.party
This commit is contained in:
parent
1e044e7aef
commit
cab2d09737
4 changed files with 19 additions and 2 deletions
|
@ -80,6 +80,10 @@ class Person(AdapterBase, BasePerson):
|
|||
_adapterAttributes = ('context', '__parent__', 'userId', 'phoneNumbers')
|
||||
_contextAttributes = list(IPerson) + list(IConcept)
|
||||
|
||||
def createExtUser(self, userId):
|
||||
from scopes.org import user
|
||||
#print('*** Person.createExtUser', userId)
|
||||
|
||||
def getUserId(self):
|
||||
return getattr(self.context, '_userId', None)
|
||||
def setUserId(self, userId):
|
||||
|
@ -111,6 +115,8 @@ class Person(AdapterBase, BasePerson):
|
|||
self.context._userId = userId
|
||||
setter.propagateSecurity()
|
||||
allowEditingForOwner(self.context, revert=not userId) # why this?
|
||||
if not oldUserId:
|
||||
self.createExtUser(userId)
|
||||
userId = property(getUserId, setUserId)
|
||||
|
||||
def removeReferenceFromPrincipal(self, userId):
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# loops.organize.tests
|
||||
|
||||
import os, sys
|
||||
#sys.path = [os.path.dirname(__file__)] + sys.path
|
||||
sys.path = ['loops/tests'] + sys.path
|
||||
|
||||
import unittest, doctest
|
||||
from zope.interface.verify import verifyClass
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ class LoginView:
|
|||
class CallbackView:
|
||||
|
||||
def __call__(self):
|
||||
oidc.Authenticator(self.request).callback()
|
||||
oidc.Authenticator(
|
||||
self.request).callback(groupsProvider=self.getGroupsForPrincipal)
|
||||
return ''
|
||||
|
||||
def getGroupsForPrincipal(self, prcId):
|
||||
|
|
|
@ -20,8 +20,14 @@ dbschema = getenv('DBSCHEMA', 'demo')
|
|||
|
||||
base_url = 'test://'
|
||||
|
||||
# special testing stuff
|
||||
from scopes.tests import data_auth # add oidc URIs and keys to dummy_requests data
|
||||
from scopes.tests import dummy_requests
|
||||
import sys
|
||||
sys.modules['requests'] = dummy_requests
|
||||
|
||||
# authentication settings
|
||||
oidc_provider = ''
|
||||
oidc_provider = 'test://oidc'
|
||||
oidc_client_id = getenv('OIDC_CLIENT_ID', '12345')
|
||||
oidc_params = dict(
|
||||
op_config_url=oidc_provider + '/.well-known/openid-configuration',
|
||||
|
|
Loading…
Add table
Reference in a new issue