Ignore:
Timestamp:
13 Feb 2012, 09:10:16 (13 years ago)
Author:
Henrik Bettermann
Message:

Fix role assignment when creating an account.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/authentication.py

    r7321 r7636  
    150150
    151151    def __init__(self, name, password, title=None, description=None,
    152                  email=None, phone=None, user_type=None, roles = []):
     152                 email=None, phone=None, roles = []):
    153153        self.name = name
    154154        if title is None:
    155155            title = name
    156         #if description is None:
    157         #    description = title
    158156        self.title = title
    159157        self.description = description
    160158        self.email = email
    161159        self.phone = phone
    162         self.user_type = user_type
    163160        self.setPassword(password)
    164         #self.setSiteRolesForPrincipal(roles)
     161        self.setSiteRolesForPrincipal(roles)
    165162        # We don't want to share this dict with other accounts
    166163        self._local_roles = dict()
  • main/waeup.sirp/trunk/src/waeup/sirp/authentication.txt

    r7321 r7636  
    3737
    3838  >>> from waeup.sirp.authentication import Account
    39   >>> alice = Account('alice', 'alicesecret')
     39  >>> alice = Account('alice', 'alicesecret',roles=['waeup.ManageDataCenter'])
    4040  >>> root['app']['users'].addAccount(alice)
    4141
     
    5151  {'waeup.local.Owner': [<waeup.sirp.authentication.Account object at 0x...>]}
    5252
    53 Users have also got the global AcademicsOfficer role:
     53User  automatically get the global AcademicsOfficer role:
    5454
    5555  >>> alice.getSiteRolesForPrincipal()
    56   ['waeup.AcademicsOfficer']
     56  ['waeup.ManageDataCenter', 'waeup.AcademicsOfficer']
    5757
    5858We can tell an account, that Alice got some role for another object:
  • main/waeup.sirp/trunk/src/waeup/sirp/userscontainer.py

    r7321 r7636  
    3939        #if description is None:
    4040        #    description = title
    41         self[name] = Account(name, password, title, description,
    42                              email, phone, roles)
     41        self[name] = Account(name=name, password=password, title=title,
     42                             description=description,
     43                             email=email, phone=phone, roles=roles)
    4344
    4445    def addAccount(self, account):
Note: See TracChangeset for help on using the changeset viewer.