Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
GroupUserFolder.tests.testLDAPGroupFolder.TestLDAPUserFolderGroups Class Reference

class TestLDAPUserFolderGroups(GRUFTestCase.GRUFTestCase): More...

Inheritance diagram for GroupUserFolder.tests.testLDAPGroupFolder.TestLDAPUserFolderGroups:
Inheritance graph
[legend]
Collaboration diagram for GroupUserFolder.tests.testLDAPGroupFolder.TestLDAPUserFolderGroups:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def gruf_sources_setup
def delete_created_users
def security_context_setup_groups
def testLDAPSourceMove
def test01_LDAPUp
def test02_groupHasRole
def test_getGroupNames
def test_getGroupIds
def test_getUserNames
def test_getUserIds
def test_getGroups
def test_userFolderDelRoles
def test_getGroupNames
def test_getGroupIds
def test_getGroups
def test_setRolesOnUsers
def test_userFolderEditUser
def test_getUsersOfRole
def test_getPureUsers
def test_getUsers
def test_userSetDomains
def test_setProperty
def test_searchUsersByAttribute
def gruf_setup
def gruf_setup
def security_context_setup
def security_context_setup
def security_context_setup_users
def security_context_setup_users
def test10GRUFMethods
def test_getUser
def test_hasUsers
def test_getUserById
def test_getUserByName
def test_getPureUserNames
def test_getPureUserIds
def test_getPureUser
def test_getGroup
def test_getGroupById
def test_getGroupByName
def test_userFolderAddUser
def test_userFolderUpdateUser
def test_userFolderDelUsers
def test_userFolderAddGroup
def test_userFolderEditGroup
def test_userFolderUpdateGroup
def test_userFolderDelGroups
def test_userSetRoles
def test_userAddRole
def test_userRemoveRole
def test_userSetPassword
def test_userGetDomains
def test_userAddDomain
def test_userRemoveDomain
def test_userSetGroups
def test_userAddGroup
def test_userRemoveGroup
def test_searchUsersByName
def test_searchUsersById
def test_searchGroupsByAttribute
def test_searchGroupsByName
def test_searchGroupsById
def test_setRolesOnGroups
def test_getRolesOfUser
def test_userFolderGetRoles
def test_userFolderAddRole
def test_getMemberIds
def test_getUserMemberIds
def test_getGroupMemberIds
def test_addMember
def test_removeMember
def test_setMembers
def test_hasMember
def test_getRealId
def test_acquireLocalRoles
def test_isLocalRoleAcquired
def test_getAllLocalRoles
def test01Interfaces
def test02TestCaseCompletude
def test03ClassSecurityInfo

Public Attributes

 gruf_folder
 gruf_folder
 gruf
 gruf
 lr
 lr
 sublr
 sublr
 sublr2
 sublr2
 sublr3
 sublr3
 subsublr2
 subsublr2
 subsublr3
 subsublr3

Static Public Attributes

tuple klasses

Detailed Description

class TestLDAPUserFolderGroups(GRUFTestCase.GRUFTestCase):

Now we create groups into LDAP. Groups won't be locally stored anymore.
Remember that according to LDAPUF, a LDAP group = a zope role.
However, for GRUF, a zope group = a zope role.
So, by transitivity, we must be able at some point to say that a zope group = a LDAP group ;)

The only caveat with this system is that we have to declare the zope roles we'll use in LDAP.
That's why we create a few additional groups in gruf_sources_setup().

Definition at line 107 of file testLDAPGroupFolder.py.


Member Function Documentation

Definition at line 157 of file testLDAPGroupFolder.py.

00157 
00158     def delete_created_users(self,):
00159         "ldap-specify deletion"
00160         # Purge existing users in order to start on a clean basis
00161         groups = [
00162             "g1",
00163             "g2",
00164             "g3",
00165             "g4",
00166             "ng1",
00167             "ng2",
00168             "ng3",
00169             "ng4",
00170             "ng5",
00171             "created_group",
00172             "test_prefix",
00173             "extranet",
00174             "intranet",
00175             "compta",
00176             "r1",
00177             "r2",
00178             "r3",
00179             "r4",
00180             ]
00181         g_dn = []
00182         for group in groups:
00183             g_dn.append("cn=%s,%s" % (group, self.gruf.Users.acl_users.groups_base, ))
00184         self.gruf.Users.acl_users.manage_deleteGroups(g_dn)
00185         self.gruf.userFolderDelUsers([
00186             "manager",
00187             "u1",
00188             "u2",
00189             "u3",
00190             "u4",
00191             "u5",
00192             "u6",
00193             "u7",
00194             "u8",
00195             "u9",
00196             "u10",
00197             "u11",
00198             "created_user",
00199             "group_test_prefix",
00200             ])

Here is the caller graph for this function:

gruf_setup(self,) => Basic gruf setup

Definition at line 86 of file GRUFTestCase.py.

00086 
00087     def gruf_setup(self,):
00088         """
00089         gruf_setup(self,) => Basic gruf setup
00090         """
00091         # Replace default acl_user by a GRUF one
00092         self.folder.manage_delObjects(['acl_users'])
00093         self.folder.manage_addProduct['OFSP'].manage_addFolder('testFolder')
00094         self.gruf_folder = self.folder.testFolder
00095         self.gruf_folder.manage_addProduct['GroupUserFolder'].manage_addGroupUserFolder()
00096         self.gruf = self.gruf_folder.acl_users
00097 

Here is the caller graph for this function:

gruf_setup(self,) => Basic gruf setup

Definition at line 86 of file GRUFTestCase.py.

00086 
00087     def gruf_setup(self,):
00088         """
00089         gruf_setup(self,) => Basic gruf setup
00090         """
00091         # Replace default acl_user by a GRUF one
00092         self.folder.manage_delObjects(['acl_users'])
00093         self.folder.manage_addProduct['OFSP'].manage_addFolder('testFolder')
00094         self.gruf_folder = self.folder.testFolder
00095         self.gruf_folder.manage_addProduct['GroupUserFolder'].manage_addGroupUserFolder()
00096         self.gruf = self.gruf_folder.acl_users
00097 

Here is the caller graph for this function:

Basic LDAP initialization inside gruf's user source

Reimplemented from GroupUserFolder.tests.testLDAPUserFolder.TestLDAPUserFolderBasics.

Definition at line 118 of file testLDAPGroupFolder.py.

00118 
00119     def gruf_sources_setup(self,):
00120         """
00121         Basic LDAP initialization inside gruf's user source
00122         """
00123         # User source replacement
00124         self.gruf.replaceUserSource("Users",
00125             "manage_addProduct/LDAPUserFolder/manage_addLDAPUserFolder",
00126             )
00127         self.gruf.replaceUserSource(
00128             "Groups",
00129             "manage_addProduct/GroupUserFolder/manage_addLDAPGroupFolder",
00130             title = "MyLDAPGF",
00131             luf = "Users",
00132             )
00133 
00134         # Edit LDAPUF 'cause objectClass cannot be set otherwise :(
00135         self.gruf.Users.acl_users.manage_edit(
00136             title = dg('title'),
00137             #LDAP_server = dg('server'),
00138             login_attr = dg('login_attr'),
00139             uid_attr = dg('uid_attr'),
00140             users_base = dg('users_base'),
00141             users_scope = dg('users_scope'),
00142             roles= dg('roles'),
00143             obj_classes = 'top,inetOrgPerson',
00144             groups_base = dg('groups_base'),
00145             groups_scope = dg('groups_scope'),
00146             binduid = dg('binduid'),
00147             bindpwd = dg('bindpwd'),
00148             binduid_usage = dg('binduid_usage'),
00149             rdn_attr = dg('rdn_attr'),
00150             local_groups = dg('local_groups'),
00151             encryption = dg('encryption'),
00152             #use_ssl = dg('use_ssl'),
00153             #read_only=dg('read_only'),
00154             )
00155 
00156         self.delete_created_users()

Here is the call graph for this function:

Build a complex security environment

It creates:
  * 3 roles, r1, r2 and r3
  * 3 groups: g1, g2, g3
  * n users as follows (roles are between parenthesis)

      !   g1    ! g2(r1)     ! g3(r2)     ! g4(r2,r3)  !  Resulting roles !
  ------------!---------!------------!------------!------------!------------------!
  u1          !         !            !            !            !   => (no role)   !
  u2          !   X     !            !            !            !   => (no role)   !
  u3          !   X     !      X     !            !            !   => r1          !
  u4          !   X     !      X     !      X     !            !   => r1,r2       !
  u5(r1)      !         !      X     !      X     !            !   => r1,r2       !
  u6(r1)      !         !            !      X     !            !   => r1,r2       !
  u7(r1)      !         !            !            !     X      !   => r1,r2,r3    !
  ---------------------------------------------------------------------------------

It also creates a 'lr' folder in which g1 group and u3 and u6 are granted r3 role.


And then, it creates nested groups as follow (-> = belongs to group...):

     u/g   !  belongs to... ! resulting roles                     !
 ----------!----------------!-------------------------------------!
  ng1      !   g1           ! (no role)                           !
  ng2      !   g2, g3       ! r1, r2                              !
  ng3      !   g2, ng2      ! r1, r2                              !
  ng4(r3)  !   g2, ng2      ! r1, r2, r3                          !
  ng5      !   g2, ng4      ! r1, r2, r3                          !
  ng6      !   ng5, ng6     ! r1, r2, r3 (no circ. ref)           !
  u8       !   ng1          ! (no role)                           !
  u9       !   g1, ng2      ! r1, r2                              !
  u10      !   ng2, ng3     ! r1, r2                              !
  u11(r3)  !   ng2, ng3     ! r1, r2, r3                          !
  u12      !   ng5, ng6     ! r1, r2, r3                          !
 -----------------------------------------------------------------!

 Plus we have the following local roles matrix (roles inside parenthesis are implicitly
 user-defined, roles inside brackets are implicitly lr-defined).

 folder
   |
   |-- acl_users (GRUF)
   |
   |                                          r1    r2    r3
   |                             /--
   |                             | group_g1               x
   |-- lr                        | u3        (x)          x
       |                         | u6        (x)   (x)    x
       |                         \--
       |
       |                         /--
       |                         | group_g1              [x]
       |-- sublr                 | u3        (x)    x    [x]
       |                         | u6        (x)    x*   [x]
       |                         \--
       |
       |                         /--
       |                         | group_g1              [x]
       |-- sublr2                | u3        (x)    x    [x]
       |   |                     | u6        (x)    x*   [x]
       |   |                     \--
       |   |
       |   |                     /--
       |   |                     | group_g1              [x]
       |   |-- subsublr2         | u3        (x)   [x]   [x]
       |                         | u6        (x)  [(x)]  [x]
       |                         \--
       |
 (now we block local roles under this branch)
       |
       |                         /--
       |                         | group_g1              
       |-- sublr3                | u3        (x)    x    
   |                     | u6        (x)    x*   
   |                     \--
   |
   |                     /--
   |                     | group_g1              
   |-- subsublr3         | u3        (x)   [x]   
                         | u6        (x)  [(x)]  
                         \--
                         
*: u6 will have r2 as a localrole AND a userdefined role.

Definition at line 113 of file GRUFTestCase.py.

00113 
00114     def security_context_setup(self,):
00115         """
00116         Build a complex security environment
00117 
00118         It creates:
00119           * 3 roles, r1, r2 and r3
00120           * 3 groups: g1, g2, g3
00121           * n users as follows (roles are between parenthesis)
00122 
00123                       !   g1    ! g2(r1)     ! g3(r2)     ! g4(r2,r3)  !  Resulting roles !
00124           ------------!---------!------------!------------!------------!------------------!
00125           u1          !         !            !            !            !   => (no role)   !
00126           u2          !   X     !            !            !            !   => (no role)   !
00127           u3          !   X     !      X     !            !            !   => r1          !
00128           u4          !   X     !      X     !      X     !            !   => r1,r2       !
00129           u5(r1)      !         !      X     !      X     !            !   => r1,r2       !
00130           u6(r1)      !         !            !      X     !            !   => r1,r2       !
00131           u7(r1)      !         !            !            !     X      !   => r1,r2,r3    !
00132           ---------------------------------------------------------------------------------
00133 
00134         It also creates a 'lr' folder in which g1 group and u3 and u6 are granted r3 role.
00135 
00136 
00137         And then, it creates nested groups as follow (-> = belongs to group...):
00138 
00139              u/g   !  belongs to... ! resulting roles                     !
00140          ----------!----------------!-------------------------------------!
00141           ng1      !   g1           ! (no role)                           !
00142           ng2      !   g2, g3       ! r1, r2                              !
00143           ng3      !   g2, ng2      ! r1, r2                              !
00144           ng4(r3)  !   g2, ng2      ! r1, r2, r3                          !
00145           ng5      !   g2, ng4      ! r1, r2, r3                          !
00146           ng6      !   ng5, ng6     ! r1, r2, r3 (no circ. ref)           !
00147           u8       !   ng1          ! (no role)                           !
00148           u9       !   g1, ng2      ! r1, r2                              !
00149           u10      !   ng2, ng3     ! r1, r2                              !
00150           u11(r3)  !   ng2, ng3     ! r1, r2, r3                          !
00151           u12      !   ng5, ng6     ! r1, r2, r3                          !
00152          -----------------------------------------------------------------!
00153 
00154          Plus we have the following local roles matrix (roles inside parenthesis are implicitly
00155          user-defined, roles inside brackets are implicitly lr-defined).
00156 
00157          folder
00158            |
00159            |-- acl_users (GRUF)
00160            |
00161            |                                          r1    r2    r3
00162            |                             /--
00163            |                             | group_g1               x
00164            |-- lr                        | u3        (x)          x
00165                |                         | u6        (x)   (x)    x
00166                |                         \--
00167                |
00168                |                         /--
00169                |                         | group_g1              [x]
00170                |-- sublr                 | u3        (x)    x    [x]
00171                |                         | u6        (x)    x*   [x]
00172                |                         \--
00173                |
00174                |                         /--
00175                |                         | group_g1              [x]
00176                |-- sublr2                | u3        (x)    x    [x]
00177                |   |                     | u6        (x)    x*   [x]
00178                |   |                     \--
00179                |   |
00180                |   |                     /--
00181                |   |                     | group_g1              [x]
00182                |   |-- subsublr2         | u3        (x)   [x]   [x]
00183                |                         | u6        (x)  [(x)]  [x]
00184                |                         \--
00185                |
00186          (now we block local roles under this branch)
00187                |
00188                |                         /--
00189                |                         | group_g1              
00190                |-- sublr3                | u3        (x)    x    
00191                    |                     | u6        (x)    x*   
00192                    |                     \--
00193                    |
00194                    |                     /--
00195                    |                     | group_g1              
00196                    |-- subsublr3         | u3        (x)   [x]   
00197                                          | u6        (x)  [(x)]  
00198                                          \--
00199                                          
00200         *: u6 will have r2 as a localrole AND a userdefined role.
00201         """
00202         # Create a few roles
00203         self.gruf.userFolderAddRole("r1")
00204         self.gruf.userFolderAddRole("r2")
00205         self.gruf.userFolderAddRole("r3")
00206 
00207         # Set View permission on those roles
00208         permissions = self.gruf_folder.ac_inherited_permissions(1)
00209         for ip in range(len(permissions)):
00210             name, value = permissions[ip][:2]
00211             if name == "View":
00212                 break
00213         p=Permission.Permission(name,value, self.gruf_folder)
00214         p.setRoles(("r1", "r2", "r3", ))
00215 
00216         # Setup users and groups
00217         self.security_context_setup_groups()
00218         self.security_context_setup_users()
00219         
00220         # Create a few folders to play with
00221         self.gruf_folder.manage_addProduct['OFSP'].manage_addFolder('lr')
00222         lr = self.gruf_folder.lr
00223         lr.manage_addProduct['OFSP'].manage_addFolder("sublr")
00224         sublr = self.gruf_folder.lr.sublr
00225         lr.manage_addProduct['OFSP'].manage_addFolder("sublr2")
00226         sublr2 = self.gruf_folder.lr.sublr2
00227         sublr2.manage_addProduct['OFSP'].manage_addFolder("subsublr2")
00228         subsublr2 = self.gruf_folder.lr.sublr2.subsublr2
00229         lr.manage_addProduct['OFSP'].manage_addFolder("sublr3")
00230         sublr3 = self.gruf_folder.lr.sublr3
00231         sublr3.manage_addProduct['OFSP'].manage_addFolder("subsublr3")
00232         subsublr3 = self.gruf_folder.lr.sublr3.subsublr3
00233         self.gruf._acquireLocalRoles(sublr3, 0)
00234         lr.manage_addLocalRoles("group_g1", ("r3", ))
00235         lr.manage_addLocalRoles("u3", ("r3", ))
00236         lr.manage_addLocalRoles("u6", ("r3", ))
00237         sublr.manage_addLocalRoles("u3", ("r2", ))
00238         sublr.manage_addLocalRoles("u6", ("r2", ))
00239         sublr2.manage_addLocalRoles("u3", ("r2", ))
00240         sublr2.manage_addLocalRoles("u6", ("r2", ))
00241         sublr3.manage_addLocalRoles("u3", ("r2", ))
00242         sublr3.manage_addLocalRoles("u6", ("r2", ))
00243         self.lr = lr
00244         self.sublr = sublr
00245         self.sublr2 = sublr2
00246         self.sublr3 = sublr3
00247         self.subsublr2 = subsublr2
00248         self.subsublr3 = subsublr3
00249 

Here is the call graph for this function:

Here is the caller graph for this function:

Build a complex security environment

It creates:
  * 3 roles, r1, r2 and r3
  * 3 groups: g1, g2, g3
  * n users as follows (roles are between parenthesis)

      !   g1    ! g2(r1)     ! g3(r2)     ! g4(r2,r3)  !  Resulting roles !
  ------------!---------!------------!------------!------------!------------------!
  u1          !         !            !            !            !   => (no role)   !
  u2          !   X     !            !            !            !   => (no role)   !
  u3          !   X     !      X     !            !            !   => r1          !
  u4          !   X     !      X     !      X     !            !   => r1,r2       !
  u5(r1)      !         !      X     !      X     !            !   => r1,r2       !
  u6(r1)      !         !            !      X     !            !   => r1,r2       !
  u7(r1)      !         !            !            !     X      !   => r1,r2,r3    !
  ---------------------------------------------------------------------------------

It also creates a 'lr' folder in which g1 group and u3 and u6 are granted r3 role.


And then, it creates nested groups as follow (-> = belongs to group...):

     u/g   !  belongs to... ! resulting roles                     !
 ----------!----------------!-------------------------------------!
  ng1      !   g1           ! (no role)                           !
  ng2      !   g2, g3       ! r1, r2                              !
  ng3      !   g2, ng2      ! r1, r2                              !
  ng4(r3)  !   g2, ng2      ! r1, r2, r3                          !
  ng5      !   g2, ng4      ! r1, r2, r3                          !
  ng6      !   ng5, ng6     ! r1, r2, r3 (no circ. ref)           !
  u8       !   ng1          ! (no role)                           !
  u9       !   g1, ng2      ! r1, r2                              !
  u10      !   ng2, ng3     ! r1, r2                              !
  u11(r3)  !   ng2, ng3     ! r1, r2, r3                          !
  u12      !   ng5, ng6     ! r1, r2, r3                          !
 -----------------------------------------------------------------!

 Plus we have the following local roles matrix (roles inside parenthesis are implicitly
 user-defined, roles inside brackets are implicitly lr-defined).

 folder
   |
   |-- acl_users (GRUF)
   |
   |                                          r1    r2    r3
   |                             /--
   |                             | group_g1               x
   |-- lr                        | u3        (x)          x
       |                         | u6        (x)   (x)    x
       |                         \--
       |
       |                         /--
       |                         | group_g1              [x]
       |-- sublr                 | u3        (x)    x    [x]
       |                         | u6        (x)    x*   [x]
       |                         \--
       |
       |                         /--
       |                         | group_g1              [x]
       |-- sublr2                | u3        (x)    x    [x]
       |   |                     | u6        (x)    x*   [x]
       |   |                     \--
       |   |
       |   |                     /--
       |   |                     | group_g1              [x]
       |   |-- subsublr2         | u3        (x)   [x]   [x]
       |                         | u6        (x)  [(x)]  [x]
       |                         \--
       |
 (now we block local roles under this branch)
       |
       |                         /--
       |                         | group_g1              
       |-- sublr3                | u3        (x)    x    
   |                     | u6        (x)    x*   
   |                     \--
   |
   |                     /--
   |                     | group_g1              
   |-- subsublr3         | u3        (x)   [x]   
                         | u6        (x)  [(x)]  
                         \--
                         
*: u6 will have r2 as a localrole AND a userdefined role.

Definition at line 113 of file GRUFTestCase.py.

00113 
00114     def security_context_setup(self,):
00115         """
00116         Build a complex security environment
00117 
00118         It creates:
00119           * 3 roles, r1, r2 and r3
00120           * 3 groups: g1, g2, g3
00121           * n users as follows (roles are between parenthesis)
00122 
00123                       !   g1    ! g2(r1)     ! g3(r2)     ! g4(r2,r3)  !  Resulting roles !
00124           ------------!---------!------------!------------!------------!------------------!
00125           u1          !         !            !            !            !   => (no role)   !
00126           u2          !   X     !            !            !            !   => (no role)   !
00127           u3          !   X     !      X     !            !            !   => r1          !
00128           u4          !   X     !      X     !      X     !            !   => r1,r2       !
00129           u5(r1)      !         !      X     !      X     !            !   => r1,r2       !
00130           u6(r1)      !         !            !      X     !            !   => r1,r2       !
00131           u7(r1)      !         !            !            !     X      !   => r1,r2,r3    !
00132           ---------------------------------------------------------------------------------
00133 
00134         It also creates a 'lr' folder in which g1 group and u3 and u6 are granted r3 role.
00135 
00136 
00137         And then, it creates nested groups as follow (-> = belongs to group...):
00138 
00139              u/g   !  belongs to... ! resulting roles                     !
00140          ----------!----------------!-------------------------------------!
00141           ng1      !   g1           ! (no role)                           !
00142           ng2      !   g2, g3       ! r1, r2                              !
00143           ng3      !   g2, ng2      ! r1, r2                              !
00144           ng4(r3)  !   g2, ng2      ! r1, r2, r3                          !
00145           ng5      !   g2, ng4      ! r1, r2, r3                          !
00146           ng6      !   ng5, ng6     ! r1, r2, r3 (no circ. ref)           !
00147           u8       !   ng1          ! (no role)                           !
00148           u9       !   g1, ng2      ! r1, r2                              !
00149           u10      !   ng2, ng3     ! r1, r2                              !
00150           u11(r3)  !   ng2, ng3     ! r1, r2, r3                          !
00151           u12      !   ng5, ng6     ! r1, r2, r3                          !
00152          -----------------------------------------------------------------!
00153 
00154          Plus we have the following local roles matrix (roles inside parenthesis are implicitly
00155          user-defined, roles inside brackets are implicitly lr-defined).
00156 
00157          folder
00158            |
00159            |-- acl_users (GRUF)
00160            |
00161            |                                          r1    r2    r3
00162            |                             /--
00163            |                             | group_g1               x
00164            |-- lr                        | u3        (x)          x
00165                |                         | u6        (x)   (x)    x
00166                |                         \--
00167                |
00168                |                         /--
00169                |                         | group_g1              [x]
00170                |-- sublr                 | u3        (x)    x    [x]
00171                |                         | u6        (x)    x*   [x]
00172                |                         \--
00173                |
00174                |                         /--
00175                |                         | group_g1              [x]
00176                |-- sublr2                | u3        (x)    x    [x]
00177                |   |                     | u6        (x)    x*   [x]
00178                |   |                     \--
00179                |   |
00180                |   |                     /--
00181                |   |                     | group_g1              [x]
00182                |   |-- subsublr2         | u3        (x)   [x]   [x]
00183                |                         | u6        (x)  [(x)]  [x]
00184                |                         \--
00185                |
00186          (now we block local roles under this branch)
00187                |
00188                |                         /--
00189                |                         | group_g1              
00190                |-- sublr3                | u3        (x)    x    
00191                    |                     | u6        (x)    x*   
00192                    |                     \--
00193                    |
00194                    |                     /--
00195                    |                     | group_g1              
00196                    |-- subsublr3         | u3        (x)   [x]   
00197                                          | u6        (x)  [(x)]  
00198                                          \--
00199                                          
00200         *: u6 will have r2 as a localrole AND a userdefined role.
00201         """
00202         # Create a few roles
00203         self.gruf.userFolderAddRole("r1")
00204         self.gruf.userFolderAddRole("r2")
00205         self.gruf.userFolderAddRole("r3")
00206 
00207         # Set View permission on those roles
00208         permissions = self.gruf_folder.ac_inherited_permissions(1)
00209         for ip in range(len(permissions)):
00210             name, value = permissions[ip][:2]
00211             if name == "View":
00212                 break
00213         p=Permission.Permission(name,value, self.gruf_folder)
00214         p.setRoles(("r1", "r2", "r3", ))
00215 
00216         # Setup users and groups
00217         self.security_context_setup_groups()
00218         self.security_context_setup_users()
00219         
00220         # Create a few folders to play with
00221         self.gruf_folder.manage_addProduct['OFSP'].manage_addFolder('lr')
00222         lr = self.gruf_folder.lr
00223         lr.manage_addProduct['OFSP'].manage_addFolder("sublr")
00224         sublr = self.gruf_folder.lr.sublr
00225         lr.manage_addProduct['OFSP'].manage_addFolder("sublr2")
00226         sublr2 = self.gruf_folder.lr.sublr2
00227         sublr2.manage_addProduct['OFSP'].manage_addFolder("subsublr2")
00228         subsublr2 = self.gruf_folder.lr.sublr2.subsublr2
00229         lr.manage_addProduct['OFSP'].manage_addFolder("sublr3")
00230         sublr3 = self.gruf_folder.lr.sublr3
00231         sublr3.manage_addProduct['OFSP'].manage_addFolder("subsublr3")
00232         subsublr3 = self.gruf_folder.lr.sublr3.subsublr3
00233         self.gruf._acquireLocalRoles(sublr3, 0)
00234         lr.manage_addLocalRoles("group_g1", ("r3", ))
00235         lr.manage_addLocalRoles("u3", ("r3", ))
00236         lr.manage_addLocalRoles("u6", ("r3", ))
00237         sublr.manage_addLocalRoles("u3", ("r2", ))
00238         sublr.manage_addLocalRoles("u6", ("r2", ))
00239         sublr2.manage_addLocalRoles("u3", ("r2", ))
00240         sublr2.manage_addLocalRoles("u6", ("r2", ))
00241         sublr3.manage_addLocalRoles("u3", ("r2", ))
00242         sublr3.manage_addLocalRoles("u6", ("r2", ))
00243         self.lr = lr
00244         self.sublr = sublr
00245         self.sublr2 = sublr2
00246         self.sublr3 = sublr3
00247         self.subsublr2 = subsublr2
00248         self.subsublr3 = subsublr3
00249 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 201 of file testLDAPGroupFolder.py.

00201 
00202     def security_context_setup_groups(self,):
00203         "create groups. We splitted to allow LDAP tests to override this"
00204         # Create roles as GROUPS
00205         self.gruf.userFolderAddGroup('r1', )
00206         self.gruf.userFolderAddGroup('r2', )
00207         self.gruf.userFolderAddGroup('r3', )
00208         self.gruf.userFolderAddGroup('r4', )
00209 
00210         # Create a few groups
00211         self.gruf.userFolderAddGroup('g1', ())
00212         self.gruf.userFolderAddGroup('g2', ('r1', ))
00213         self.gruf.userFolderAddGroup('g3', ('r2', ))
00214         self.gruf.userFolderAddGroup('g4', ('r2', 'r3', ))
00215 
00216         # Create nested groups
00217         self.gruf.userFolderAddGroup('ng1', (), ('g1', ))
00218         self.gruf.userFolderAddGroup('ng2', (), ('g2', 'g3', ))
00219         self.gruf.userFolderAddGroup('ng3', (), ('g2', 'ng2', ))
00220         self.gruf.userFolderAddGroup('ng4', ('r3', ), ('g2', 'ng2', ))
00221         self.gruf.userFolderAddGroup('ng5', (), ('g2', 'ng4', ))
00222 
00223         # Special case of nesting
00224         self.gruf.userFolderAddGroup('extranet', (), ())
00225         self.gruf.userFolderAddGroup('intranet', (), ('extranet', ))
00226         self.gruf.userFolderAddGroup('compta', (), ('intranet', 'extranet' ))

Here is the caller graph for this function:

Definition at line 250 of file GRUFTestCase.py.

00250 
00251     def security_context_setup_users(self,):
00252         # Create a manager and a few users
00253         self.gruf.userFolderAddUser('manager', 'secret', ('Manager',), (), (), )
00254         self.gruf.userFolderAddUser('u1', 'secret', (), (), (), )
00255         self.gruf.userFolderAddUser('u2', 'secret', (), (), ('g1', ), )
00256         self.gruf.userFolderAddUser('u3', 'secret', (), (), ('g1', 'g2'), )
00257         self.gruf.userFolderAddUser('u4', 'secret', (), (), ('g1', 'g2', 'g3'), )
00258         self.gruf.userFolderAddUser('u5', 'secret', ('r1', ), (), ('g2', 'g3'), )
00259         self.gruf.userFolderAddUser('u6', 'secret', ('r1', ), (), ('g3', ), )
00260         self.gruf.userFolderAddUser('u7', 'secret', ('r1', ), (), ('g4', ), )
00261 
00262         # Create nested-groups users
00263         self.gruf.userFolderAddUser('u8', 'secret', (), (), ('ng1', ), )        
00264         self.gruf.userFolderAddUser('u9', 'secret', (), (), ('g1', 'ng2', ), )
00265         self.gruf.userFolderAddUser('u10', 'secret', (), (), ('ng2', 'ng3', ), )        
        self.gruf.userFolderAddUser('u11', 'secret', ('r3', ), (), ('ng2', 'ng3', ), )        

Here is the caller graph for this function:

Definition at line 250 of file GRUFTestCase.py.

00250 
00251     def security_context_setup_users(self,):
00252         # Create a manager and a few users
00253         self.gruf.userFolderAddUser('manager', 'secret', ('Manager',), (), (), )
00254         self.gruf.userFolderAddUser('u1', 'secret', (), (), (), )
00255         self.gruf.userFolderAddUser('u2', 'secret', (), (), ('g1', ), )
00256         self.gruf.userFolderAddUser('u3', 'secret', (), (), ('g1', 'g2'), )
00257         self.gruf.userFolderAddUser('u4', 'secret', (), (), ('g1', 'g2', 'g3'), )
00258         self.gruf.userFolderAddUser('u5', 'secret', ('r1', ), (), ('g2', 'g3'), )
00259         self.gruf.userFolderAddUser('u6', 'secret', ('r1', ), (), ('g3', ), )
00260         self.gruf.userFolderAddUser('u7', 'secret', ('r1', ), (), ('g4', ), )
00261 
00262         # Create nested-groups users
00263         self.gruf.userFolderAddUser('u8', 'secret', (), (), ('ng1', ), )        
00264         self.gruf.userFolderAddUser('u9', 'secret', (), (), ('g1', 'ng2', ), )
00265         self.gruf.userFolderAddUser('u10', 'secret', (), (), ('ng2', 'ng3', ), )        
        self.gruf.userFolderAddUser('u11', 'secret', ('r3', ), (), ('ng2', 'ng3', ), )        

Here is the caller graph for this function:

Ensure LDAP is up and running

Reimplemented from GroupUserFolder.tests.testLDAPUserFolder.TestLDAPUserFolderBasics.

Definition at line 259 of file testLDAPGroupFolder.py.

00259 
00260     def test01_LDAPUp(self,):
00261         """Ensure LDAP is up and running
00262         """
00263         self.gruf.Users.acl_users.getUsers()

Test that interfaces are okay

Definition at line 81 of file testInterface.py.

00081 
00082     def test01Interfaces(self,):
00083         """
00084         Test that interfaces are okay
00085         """
00086         # Check interface for each and every class
00087         ignore = getattr(self, "ignore_interfaces", [])
00088         for klass in self.klasses:
00089             intfs = getattr(klass, "__implements__", None)
00090             self.failUnless(intfs, "'%s' class doesn't implement an interface!" % (klass.__name__, ))
00091 
00092             # Flatten interfaces
00093             intfs = flattenList(intfs)
00094 
00095             # Check each and everyone
00096             for intf in intfs:
00097                 if intf in ignore:
00098                     continue
00099                 self.failUnless(
00100                     Verify.verifyClass(
00101                     intf,
00102                     klass,
00103                     ),
00104                     "'%s' class doesn't implement '%s' interface correctly." % (klass.__name__, intf.__name__, ),
00105                     )
00106 

Here is the call graph for this function:

Test if a group can have a role

Definition at line 264 of file testLDAPGroupFolder.py.

00264 
00265     def test02_groupHasRole(self,):
00266         """Test if a group can have a role
00267         """
00268         self.failUnless("r1" in self.gruf.getGroup("g2").getRoles(), self.gruf.getGroup("g2").getRoles(), )

Check that the test case is complete : each interface entry xxx must be associated
to a test_xxx method in the test class.

Definition at line 107 of file testInterface.py.

00107 
00108     def test02TestCaseCompletude(self,):
00109         """
00110         Check that the test case is complete : each interface entry xxx must be associated
00111         to a test_xxx method in the test class.
00112         """
00113         not_defined = []
00114         tests = dir(self)
00115         count = 0
00116         
00117         # Check interface for each and every class
00118         ignore = getattr(self, "ignore_interfaces", [])
00119         for klass in self.klasses:
00120             intfs = getattr(klass, "__implements__", None)
00121             self.failUnless(intfs, "'%s' class doesn't implement an interface!" % (klass.__name__, ))
00122 
00123             # Flatten interfaces
00124             intfs = flattenInterfaces(intfs)
00125 
00126             # Check each and every interface
00127             for intf in intfs:
00128                 if intf in ignore:
00129                     continue
00130                 for name in intf.names():
00131                     count += 1
00132                     if not "test_%s" % (name,) in tests:
00133                         not_defined.append("%s.%s" % (klass.__name__, name))
00134 
00135 
00136         # Raise in case some tests are missing
00137         if not_defined:
00138             raise RuntimeError, "%d (over %d) MISSING TESTS:\n%s do not have a test associated." % (
00139                 len(not_defined),
00140                 count,
00141                 string.join(not_defined, ", "),
00142                 )
00143         
        

Here is the call graph for this function:

This method tests that each and every method has a ClassSecurityInfo() declaration
XXX This doesn't walk through inheritance :(

Reimplemented in GroupUserFolder.tests.testUserAPI.TestUserFolderAPI.

Definition at line 144 of file testInterface.py.

00144 
00145     def test03ClassSecurityInfo(self):
00146         """
00147         This method tests that each and every method has a ClassSecurityInfo() declaration
00148         XXX This doesn't walk through inheritance :(
00149         """
00150         not_defined = []
00151         count = 0
00152         
00153         # Check interface for each and every class
00154         ignore = getattr(self, "ignore_interfaces", [])
00155         for klass in self.klasses:
00156             dict = dir(klass)
00157             intfs = getattr(klass, "__implements__", None)
00158             self.failUnless(intfs, "'%s' class doesn't implement an interface!" % (klass.__name__, ))
00159 
00160             # Flatten interfaces
00161             intfs = flattenInterfaces(intfs)
00162             
00163             # Now check the resulting class to see if the mapping was made
00164             # correctly. Note that this uses carnal knowledge of the internal
00165             # structures used to store this information!
00166             # Check each method of every interface
00167             for intf in intfs:
00168                 if intf in ignore:
00169                     continue
00170                 for name in intf.names():
00171                     count += 1
00172                     if not "%s__roles__" % (name,) in dict:
00173                         not_defined.append("%s.%s" % (klass.__name__, name))
00174 
00175         # Raise in case some tests are missing
00176         if not_defined:
00177             raise RuntimeError, "%d (over %d) MISSING SECURITY DECLARATIONS:\n%s do not have a security declaration associated." % (
00178                 len(not_defined),
00179                 count,
00180                 string.join(not_defined, ", "),
00181                 )
00182         

Here is the call graph for this function:

We test that GRUF's API is well protected

Definition at line 66 of file testGroupUserFolderAPI.py.

00066 
00067     def test10GRUFMethods(self,):
00068         """
00069         We test that GRUF's API is well protected
00070         """
00071         self.assertRaises(Unauthorized, self.gruf_folder.restrictedTraverse, 'acl_users/getGRUFPhysicalRoot')
00072         self.assertRaises(Unauthorized, self.gruf_folder.restrictedTraverse, 'acl_users/getGRUFPhysicalRoot')

We block LR acquisition on sublr2.
See GRUFTestCase to understand what happens (basically, roles in brackets
will be removed from sublr2).

Definition at line 871 of file testGroupUserFolderAPI.py.

00871 
00872     def test_acquireLocalRoles(self,):
00873         """
00874         We block LR acquisition on sublr2.
00875         See GRUFTestCase to understand what happens (basically, roles in brackets
00876         will be removed from sublr2).
00877         """
00878         # Initial check
00879         self.failUnless(self.compareRoles(self.sublr2, "u2", ("r3", )))
00880         self.failUnless(self.compareRoles(self.sublr2, "u3", ("r1", "r2", "r3", )))
00881         self.failUnless(self.compareRoles(self.sublr2, "u6", ("r1", "r2", "r3", )))
00882         self.failUnless(self.compareRoles(self.subsublr2, "u2", ("r3", )))
00883         self.failUnless(self.compareRoles(self.subsublr2, "u3", ("r1", "r2", "r3", )))
00884         self.failUnless(self.compareRoles(self.subsublr2, "u6", ("r1", "r2", "r3", )))
00885         
00886         # Disable LR acquisition on sublr2 and test the stuff
00887         self.gruf._acquireLocalRoles(self.sublr2, 0)
00888         self.failUnless(self.compareRoles(self.sublr2, "u2", ()))
00889         self.failUnless(self.compareRoles(self.sublr2, "u3", ("r1", "r2", )))
00890         self.failUnless(self.compareRoles(self.sublr2, "u6", ("r1", "r2", )))
00891         self.failUnless(self.compareRoles(self.subsublr2, "u2", ()))
00892         self.failUnless(self.compareRoles(self.subsublr2, "u3", ("r1", "r2", )))
00893         self.failUnless(self.compareRoles(self.subsublr2, "u6", ("r1", "r2", )))

Here is the call graph for this function:

Add a member to a group

Definition at line 820 of file testGroupUserFolderAPI.py.

00820 
00821     def test_addMember(self):
00822         """Add a member to a group
00823         """
00824         self.failUnless("u1" not in self.gruf.getMemberIds("ng3"))
00825         self.gruf.addMember("ng3", "u1")
00826         self.failUnless("u1" in self.gruf.getMemberIds("ng3"))

Definition at line 910 of file testGroupUserFolderAPI.py.

00910 
00911     def test_getAllLocalRoles(self):
00912         # Allowed patterns
00913         normal_allowed = {
00914             'group_g1': ['r3', ],
00915             'u6': ['r2', 'r3', ],
00916             'test_user_1_': ['Owner', ],
00917             'u3': ['r2', 'r3', ],
00918             }
00919         blocked_allowed = {
00920             'u6': ['r2', ],
00921             'test_user_1_': ['Owner', ],
00922             'u3': ['r2', ],
00923             }
00924 
00925         # Normal behaviour
00926         ob = self.sublr2
00927         allowed = self.gruf._getAllLocalRoles(ob)
00928         self.failUnlessEqual(allowed, normal_allowed)
00929 
00930         # LR-blocking behaviour
00931         ob = self.sublr2
00932         self.gruf._acquireLocalRoles(ob, 0)
00933         allowed = self.gruf._getAllLocalRoles(ob)
00934         self.failUnlessEqual(allowed, blocked_allowed)
00935 

Definition at line 280 of file testGroupUserFolderAPI.py.

00280 
00281     def test_getGroup(self):
00282         # Check name access
00283         grp = self.gruf.getGroup("g1")
00284         self.failUnless(grp.__class__.__name__ == "GRUFGroup")
00285         self.failUnless(grp.getId() == "group_g1")
00286 
00287         # Check id access
00288         grp = self.gruf.getGroup("group_g1")
00289         self.failUnless(grp.isGroup())
00290         self.failUnless(grp.getId() == "group_g1")
00291         self.failUnless(grp.__class__.__name__ == "GRUFGroup")
00292 
00293         # Prevent user access
00294         usr = self.gruf.getGroup("u1")
00295         self.failUnless(usr is None)

Definition at line 296 of file testGroupUserFolderAPI.py.

00296 
00297     def test_getGroupById(self):
00298         # Id access
00299         grp = self.gruf.getGroupById("group_g1")
00300         self.failUnless(grp.getId() == "group_g1")
00301 
00302         # Prevent name access
00303         grp = self.gruf.getGroupById("g1", default = None)
00304         self.failUnless(grp is None)
00305 
00306         # Prevent user access
00307         grp = self.gruf.getGroupById("u1", default = None)
00308         self.failUnless(grp is None)
00309 
00310         # Check raise if user/group not found
00311         self.failUnlessEqual(
00312             self.gruf.getGroupById("ZORGLUB"),
00313             None,
00314             )
00315         self.failUnless(self.gruf.getGroupById("ZORGLUB", default = "bla") == "bla")

Definition at line 316 of file testGroupUserFolderAPI.py.

00316 
00317     def test_getGroupByName(self):
00318         # Name access
00319         grp = self.gruf.getGroupByName("g1")
00320         self.failUnless(grp.getId() == "group_g1")
00321 
00322         # Allow id access
00323         grp = self.gruf.getGroupByName("group_g1", default = None)
00324         self.failUnless(grp.getId() == "group_g1")
00325 
00326         # Prevent user access
00327         self.failUnless(self.gruf.getGroupByName("u1", default = None) is None)
00328 
00329         # Check raise if user/group not found
00330         self.failUnlessEqual(
00331             self.gruf.getGroupByName("ZORGLUB"),
00332             None,
00333             )
00334         self.failUnless(self.gruf.getGroupByName("ZORGLUB", default = "bla") == "bla")

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 272 of file testLDAPGroupFolder.py.

00272 
00273     def test_getGroupIds(self,):
00274         pass                    # Ignore

Here is the caller graph for this function:

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 313 of file testLDAPGroupFolder.py.

00313 
00314     def test_getGroupIds(self,):
00315         un = self.gruf.getGroupIds()
00316         users = [
00317             'group_g1', 'group_g2', "group_g3", "group_g4",
00318             "group_ng1", "group_ng2", "group_ng3", "group_ng4", "group_ng5",
00319             "group_extranet", "group_intranet", "group_compta",
00320             "group_r1", "group_r2", "group_r3", "group_r4",
00321             ]
00322         un.sort()
00323         users.sort()
00324         for u in users:
00325             self.failUnless(u in un, "Invalid users list: '%s' is not in acl_users." % (u,))
00326         for u in un:
00327             self.failUnless(u in users, "Invalid users list: '%s' is in acl_users but shouldn't be there." % (u,))
00328 

Here is the call graph for this function:

Definition at line 808 of file testGroupUserFolderAPI.py.

00808 
00809     def test_getGroupMemberIds(self,):
00810         should_be = [
00811             'group_ng2',
00812             'group_ng3',
00813             'group_ng4',
00814             'group_ng5',
00815             ]
00816         should_be.sort()
00817         users = list(self.gruf.getGroupMemberIds("g3"))
00818         users.sort()
00819         self.failUnless(users == should_be, (users, should_be, ))

Same as getUserNames() but without pure users.

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 269 of file testLDAPGroupFolder.py.

00269 
00270     def test_getGroupNames(self,):
00271         pass                    # Ignore

Here is the caller graph for this function:

Same as getUserNames() but without pure users.

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 296 of file testLDAPGroupFolder.py.

00296 
00297     def test_getGroupNames(self):
00298         """Same as getUserNames() but without pure users.
00299         """
00300         un = self.gruf.getGroupNames()
00301         users = [
00302             'g1', 'g2', "g3", "g4",
00303             "ng1", "ng2", "ng3", "ng4", "ng5",
00304             "extranet", "intranet", "compta",
00305             "r1", "r2", "r3", "r4",
00306             ]
00307         un.sort()
00308         users.sort()
00309         for u in users:
00310             self.failUnless(u in un, "Invalid users list: '%s' is not in acl_users." % (u,))
00311         for u in un:
00312             self.failUnless(u in users, "Invalid users list: '%s' is in acl_users but shouldn't be there." % (u,))

Here is the call graph for this function:

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 281 of file testLDAPGroupFolder.py.

00281 
00282     def test_getGroups(self,):
00283         pass                    # Ignore

Here is the caller graph for this function:

Overloaded because roles are groups

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 329 of file testLDAPGroupFolder.py.

00329 
00330     def test_getGroups(self):
00331         """Overloaded because roles are groups"""
00332         objects = self.gruf.getGroups()
00333         un = map(lambda x: x.getId(), objects)
00334         users = [
00335             'group_g1', 'group_g2', "group_g3", "group_g4",
00336             "group_ng1", "group_ng2", "group_ng3", "group_ng4", "group_ng5",
00337             "group_extranet", "group_intranet", "group_compta",
00338             "group_r1", "group_r2", "group_r3", "group_r4",
00339             ]
00340         un.sort()
00341         users.sort()
00342         for u in users:
00343             self.failUnless(u in un, "Invalid users list: '%s' is not in acl_users." % (u,))
00344         for u in un:
00345             self.failUnless(u in users, "Invalid users list: '%s' is in acl_users but shouldn't be there." % (u,))
00346 

Here is the call graph for this function:

Definition at line 775 of file testGroupUserFolderAPI.py.

00775 
00776     def test_getMemberIds(self,):
00777         should_be = [
00778             'group_ng2',
00779             'group_ng3',
00780             'group_ng4',
00781             'group_ng5',
00782             'u9',
00783             'u5',
00784             'u4',
00785             'u6',
00786             'u11',
00787             'u10',
00788             ]
00789         should_be.sort()
00790         users = list(self.gruf.getMemberIds("g3"))
00791         users.sort()
00792         self.failUnless(users == should_be, (users, should_be))

Definition at line 220 of file testGroupUserFolderAPI.py.

00220 
00221     def test_getPureUser(self,):
00222         u = self.gruf.getPureUser("u1")
00223         self.failUnless(u)
00224         u = self.gruf.getPureUser("g1")
00225         self.failUnless(not u)
00226         u = self.gruf.getPureUser("group_g1")
00227         self.failUnless(not u)
00228         u = self.gruf.getPureUser("group_u1")
00229         self.failUnless(not u)
00230         u = self.gruf.getPureUser("u4")
00231         self.failUnless(u)
        
Same as getUserIds() but without groups

Definition at line 188 of file testGroupUserFolderAPI.py.

00188 
00189     def test_getPureUserIds(self,):
00190         """Same as getUserIds() but without groups
00191         """
00192         un = self.gruf.getPureUserIds()
00193         users = [
00194             "manager",
00195             "u1", "u2", "u3", "u4", "u5", "u6", "u7", "u8", "u9", "u10", "u11",
00196             ]
00197         un.sort()
00198         users.sort()
00199         for u in users:
00200             self.failUnless(u in un, "Invalid users list: '%s' is not in acl_users." % (u,))
00201         for u in un:
00202             self.failUnless(u in users, "Invalid users list: '%s' is in acl_users but shouldn't be there." % (u,))

Same as getUserNames() but without groups

Definition at line 173 of file testGroupUserFolderAPI.py.

00173 
00174     def test_getPureUserNames(self):
00175         """Same as getUserNames() but without groups
00176         """
00177         un = self.gruf.getPureUserNames()
00178         users = [
00179             "manager",
00180             "u1", "u2", "u3", "u4", "u5", "u6", "u7", "u8", "u9", "u10", "u11",
00181             ]
00182         un.sort()
00183         users.sort()
00184         for u in users:
00185             self.failUnless(u in un, "Invalid users list: '%s' is not in acl_users." % (u,))
00186         for u in un:
00187             self.failUnless(u in users, "Invalid users list: '%s' is in acl_users but shouldn't be there." % (u,))

The original test didn't work because of LDAPUF's cache -> we disable

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 176 of file testLDAPUserFolder.py.

00176 
00177     def test_getPureUsers(self):
00178         """
00179         The original test didn't work because of LDAPUF's cache -> we disable
00180         """
00181         pass

Test group id without group prefix

Definition at line 863 of file testGroupUserFolderAPI.py.

00863 
00864     def test_getRealId(self,):
00865         """Test group id without group prefix"""
00866         g = self.gruf.getUser("group_ng2")
00867         self.failUnless(g.getRealId() == "ng2")
00868         u = self.gruf.getUser("u1")
00869         self.failUnless(u.getRealId() == "u1")

Definition at line 717 of file testGroupUserFolderAPI.py.

00717 
00718     def test_getRolesOfUser(self):
00719         self.failUnless("r1" in self.gruf.getRolesOfUser("u3"), self.gruf.getRolesOfUser("u3"), )

Definition at line 109 of file testGroupUserFolderAPI.py.

00109 
00110     def test_getUser(self):
00111         # Check id access
00112         usr = self.gruf.getUser("u1")
00113         self.failUnless(usr.__class__.__name__ == "GRUFUser")
00114         self.failUnless(usr.getUserName() == "u1")
00115         grp = self.gruf.getUser("group_g1")
00116         self.failUnless(grp.__class__.__name__ == "GRUFGroup")
00117         self.failUnless(grp.isGroup())
00118         self.failUnless(grp.getId() == "group_g1")
00119 
00120         # Check name access for groups
00121         grp = self.gruf.getUser("g1")
00122         self.failUnless(grp.__class__.__name__ == "GRUFGroup")
00123         self.failUnless(grp.isGroup())
00124         self.failUnless(grp.getId() == "group_g1")

Definition at line 145 of file testGroupUserFolderAPI.py.

00145 
00146     def test_getUserById(self):
00147         # Check user & group access
00148         self.failUnless(self.gruf.getUserById("u1").getUserName() == "u1")
00149         self.failUnless(self.gruf.getUserById("group_g1").getId() == "group_g1")
00150 
00151         # Prohibit direct group access
00152         self.failUnless(self.gruf.getUserById("g1", default = None) is None)
00153 
00154         # check exception raising & default values
00155         ret = self.gruf.getUserById("ZORGLUB")
00156         self.failUnlessEqual(ret, None, "getUserById should return None")
00157         self.failUnless(self.gruf.getUserById("ZORGLUB", default = "bla") == "bla")

Definition at line 158 of file testGroupUserFolderAPI.py.

00158 
00159     def test_getUserByName(self):
00160         # Check user & group access
00161         self.failUnless(self.gruf.getUserByName("u1").getUserName() == "u1")
00162         self.failUnless(self.gruf.getUserByName("g1").getId() == "group_g1")
00163 
00164         # Check group id access
00165         self.failUnless(self.gruf.getUserByName("group_g1", None).getId() == "group_g1")
00166 
00167         # Check exception raising
00168         ret = self.gruf.getUserByName("ZORGLUB")
00169         self.failUnlessEqual(ret, None, "getUserByName should return None")
00170         self.failUnless(self.gruf.getUserByName("ZORGLUB", default = "bla") == "bla")

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 278 of file testLDAPGroupFolder.py.

00278 
00279     def test_getUserIds(self,):
00280         pass                    # Ignore

This tests nested groups

Definition at line 793 of file testGroupUserFolderAPI.py.

00793 
00794     def test_getUserMemberIds(self,):
00795         """This tests nested groups"""
00796         should_be = [
00797             'u9',
00798             'u5',
00799             'u4',
00800             'u6',
00801             'u11',
00802             'u10',
00803             ]
00804         should_be.sort()
00805         users = list(self.gruf.getUserMemberIds("g3"))
00806         users.sort()
00807         self.failUnless(users == should_be, (users, should_be, ))
        

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 275 of file testLDAPGroupFolder.py.

00275 
00276     def test_getUserNames(self,):
00277         pass                    # Ignore

The original test didn't work because of LDAPUF's cache -> we disable

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 182 of file testLDAPUserFolder.py.

00182 
00183     def test_getUsers(self,):
00184         """
00185         The original test didn't work because of LDAPUF's cache -> we disable
00186         """
00187         pass

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 370 of file testLDAPGroupFolder.py.

00370 
00371     def test_getUsersOfRole(self):
00372         should_be = [
00373             'group_ng2','group_ng3',
00374             'group_ng4',
00375             'group_ng5',
00376             'u9',
00377             'u5',
00378             'u4',
00379             'u7',
00380             'u6',
00381             'u11',
00382             'u10',
00383             'group_g3',
00384             'group_g4',
00385             ]
00386         should_be.sort()
00387         users = list(self.gruf.getUsersOfRole("r2"))
00388         users.sort()
00389         self.failUnless(users == should_be, (should_be, users, ))
00390 

Definition at line 852 of file testGroupUserFolderAPI.py.

00852 
00853     def test_hasMember(self,):
00854         self.failUnless(not self.gruf.hasMember("ng3", "u1"))
00855         self.failUnless(not self.gruf.hasMember("group_ng3", "u1"))
00856         self.gruf.addMember("ng3", "u1")
00857         self.failUnless(self.gruf.hasMember("ng3", "u1"))
00858         self.failUnless(self.gruf.hasMember("group_ng3", "u1"))
00859         self.gruf.removeMember("ng3", "u1")
00860         self.failUnless(not self.gruf.hasMember("ng3", "u1"))
00861         self.failUnless(not self.gruf.hasMember("group_ng3", "u1"))

Definition at line 125 of file testGroupUserFolderAPI.py.

00125 
00126     def test_hasUsers(self):
00127         self.failUnlessEqual(self.gruf.hasUsers(), 1, "GRUF should always return 1 on hasUsers but didn't.")

Definition at line 894 of file testGroupUserFolderAPI.py.

00894 
00895     def test_isLocalRoleAcquired(self,):
00896         self.gruf._acquireLocalRoles(self.sublr2, 0)
00897         self.failUnless(not self.gruf.isLocalRoleAcquired(self.sublr2))
00898         self.failUnless(self.gruf.isLocalRoleAcquired(self.subsublr2))
00899         self.gruf._acquireLocalRoles(self.subsublr2, 0)
00900         self.failUnless(not self.gruf.isLocalRoleAcquired(self.sublr2))
00901         self.failUnless(not self.gruf.isLocalRoleAcquired(self.subsublr2))
00902         self.gruf._acquireLocalRoles(self.sublr2, 1)
00903         self.failUnless(self.gruf.isLocalRoleAcquired(self.sublr2))
00904         self.failUnless(not self.gruf.isLocalRoleAcquired(self.subsublr2))
00905         self.gruf._acquireLocalRoles(self.subsublr2, 1)
00906         self.failUnless(self.gruf.isLocalRoleAcquired(self.sublr2))
00907         self.failUnless(self.gruf.isLocalRoleAcquired(self.subsublr2))

Remove a member from a group

Definition at line 827 of file testGroupUserFolderAPI.py.

00827 
00828     def test_removeMember(self):
00829         """Remove a member from a group
00830         """
00831         self.failUnless("u1" not in self.gruf.getMemberIds("ng3"))
00832         self.gruf.addMember("ng3", "u1")
00833         self.failUnless("u1" in self.gruf.getMemberIds("ng3"))
00834         self.gruf.removeMember("ng3", "u1")
00835         self.failUnless("u1" not in self.gruf.getMemberIds("ng3"))

Definition at line 624 of file testGroupUserFolderAPI.py.

00624 
00625     def test_searchGroupsByAttribute(self,):
00626         # Not suitable for regular UFs
00627         self.failUnlessRaises(
00628             NotImplementedError,
00629             self.gruf.searchGroupsByAttribute,
00630             "a",
00631             "b",
00632             )

Definition at line 658 of file testGroupUserFolderAPI.py.

00658 
00659     def test_searchGroupsById(self,):
00660         # Simple match
00661         self.failUnlessEqual(
00662             self.gruf.searchGroupsById("g5"),
00663             ["group_ng5",],
00664             )
00665 
00666         # Different case matching
00667         self.failUnlessEqual(
00668             self.gruf.searchGroupsById("G5"),
00669             ["group_ng5",],
00670             )
00671 
00672         # Multiple (different case) matching
00673         s = self.gruf.searchGroupsById("G1")
00674         s.sort()
00675         self.failUnlessEqual(
00676             s,
00677             ["group_g1", "group_ng1", ]
00678             )

Definition at line 633 of file testGroupUserFolderAPI.py.

00633 
00634     def test_searchGroupsByName(self,):
00635         # Simple match
00636         lst = self.gruf.searchGroupsByName("g3")
00637         lst.sort()
00638         self.failUnlessEqual(
00639             lst,
00640             ["group_g3", "group_ng3", ],
00641             )
00642 
00643         # Different case matching
00644         lst = self.gruf.searchGroupsByName("g3")
00645         lst.sort()
00646         self.failUnlessEqual(
00647             lst,
00648             ["group_g3", "group_ng3", ],
00649             )
00650 
00651         # Multiple (different case) matching
00652         s = self.gruf.searchGroupsByName("1")
00653         s.sort()
00654         self.failUnlessEqual(
00655             s,
00656             ["group_g1", "group_ng1", ]
00657             )

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 207 of file testLDAPUserFolder.py.

00207 
00208     def test_searchUsersByAttribute(self,):
00209         # Simple match
00210         self.failUnlessEqual(
00211             self.gruf.searchUsersByAttribute(defaults['login_attr'], "u3"),
00212             ["u3",],
00213             )
00214 
00215         # Different case matching
00216         self.failUnlessEqual(
00217             self.gruf.searchUsersByAttribute(defaults['login_attr'], "U3"),
00218             ["u3",],
00219             )
00220 
00221         # Multiple (different case) matching
00222         s = self.gruf.searchUsersByAttribute(defaults['login_attr'], "U")
00223         s.sort()
00224         self.failUnlessEqual(
00225             s,
00226             ['u1', 'u10', 'u11', 'u2', 'u3', 'u4', 'u5', 'u6', 'u7', 'u8', 'u9', ],
00227             )
00228         
00229 

Definition at line 603 of file testGroupUserFolderAPI.py.

00603 
00604     def test_searchUsersById(self,):
00605         # Simple match
00606         self.failUnlessEqual(
00607             self.gruf.searchUsersById("u3"),
00608             ["u3",],
00609             )
00610 
00611         # Different case matching
00612         self.failUnlessEqual(
00613             self.gruf.searchUsersById("U3"),
00614             ["u3",],
00615             )
00616 
00617         # Multiple (different case) matching
00618         s = self.gruf.searchUsersById("U")
00619         s.sort()
00620         self.failUnlessEqual(
00621             s,
00622             ['u1', 'u10', 'u11', 'u2', 'u3', 'u4', 'u5', 'u6', 'u7', 'u8', 'u9', ],
00623             )

Definition at line 582 of file testGroupUserFolderAPI.py.

00582 
00583     def test_searchUsersByName(self,):
00584         # Simple match
00585         self.failUnlessEqual(
00586             self.gruf.searchUsersByName("u3"),
00587             ["u3",],
00588             )
00589 
00590         # Different case matching
00591         self.failUnlessEqual(
00592             self.gruf.searchUsersByName("U3"),
00593             ["u3",],
00594             )
00595 
00596         # Multiple (different case) matching
00597         s = self.gruf.searchUsersByName("U")
00598         s.sort()
00599         self.failUnlessEqual(
00600             s,
00601             ['u1', 'u10', 'u11', 'u2', 'u3', 'u4', 'u5', 'u6', 'u7', 'u8', 'u9', ],
00602             )

Set the members of the group

Definition at line 836 of file testGroupUserFolderAPI.py.

00836 
00837     def test_setMembers(self):
00838         """Set the members of the group
00839         """
00840         member_ids = self.gruf.getMemberIds("ng3")
00841         self.gruf.addMember("ng3", "u1")
00842         self.gruf.addMember("ng3", "u2")
00843         self.failIf("u1" not in self.gruf.getMemberIds("ng3"))
00844         self.failIf("u2" not in self.gruf.getMemberIds("ng3"))
00845         self.failIf("u3" in self.gruf.getMemberIds("ng3"))
00846 
00847         self.gruf.setMembers("ng3", (member_ids + ["u2", "u3"]))
00848 
00849         self.failIf("u1" in self.gruf.getMemberIds("ng3"))
00850         self.failIf("u2" not in self.gruf.getMemberIds("ng3"))
00851         self.failIf("u3" not in self.gruf.getMemberIds("ng3"))

Set user's properties

Definition at line 194 of file testLDAPUserFolder.py.

00194 
00195     def test_setProperty(self,):
00196         """Set user's properties
00197         """
00198         u1 = self.gruf.getUser("u1")
00199 
00200         # Simplest case: sn property setting
00201         u1.setProperty("sn", "Second Name Value")
00202 
00203         # We check that it has been changed
00204         self.failUnless(u1.getProperty("sn") == "Second Name Value", u1.getProperty("sn"), )
00205 
00206 

Same as test_setRolesOnUsers but with groups

Definition at line 691 of file testGroupUserFolderAPI.py.

00691 
00692     def test_setRolesOnGroups(self,):
00693         """Same as test_setRolesOnUsers but with groups"""
00694         self.gruf.setRolesOnUsers(["r1", "r2", "r3", ], ["g1", "g2", ])
00695         self.compareRoles(None, "g1", ["r1", "r2", "r3", ])
00696         self.compareRoles(None, "g2", ["r1", "r2", "r3", ])

Here is the call graph for this function:

Set a common set of roles for a bunch of user atoms.
We changed this because LDAPUF add garbage roles :(
See http://www.dataflake.org/tracker/issue_00376

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 347 of file testLDAPGroupFolder.py.

00347 
00348     def test_setRolesOnUsers(self):
00349         """Set a common set of roles for a bunch of user atoms.
00350         We changed this because LDAPUF add garbage roles :(
00351         See http://www.dataflake.org/tracker/issue_00376
00352         """
00353         self.gruf.setRolesOnUsers(["r1", "r2", "r3", ], ["u1", "u2", ])
00354         for r in ("r1", "r2", "r3",):
00355             self.failUnless(r in self.gruf.getUser("u1").getRoles(), self.gruf.getUser("u1").getRoles(), )
00356             self.failUnless(r in self.gruf.getUser("u2").getRoles(), self.gruf.getUser("u2").getRoles(), )
00357 
00358 

Definition at line 523 of file testGroupUserFolderAPI.py.

00523 
00524     def test_userAddDomain(self):
00525         ""

Definition at line 543 of file testGroupUserFolderAPI.py.

00543 
00544     def test_userAddGroup(self):
00545         # Test user
00546         self.gruf.userFolderAddUser(
00547             name = "created_user",
00548             password = "secret",
00549             groups = ["g2", ],
00550             roles = (),
00551             domains = (),
00552             )
00553         self.gruf.userAddGroup(
00554             "created_user",
00555             "g1",
00556             )
00557         self.compareGroups("created_user", ["g1", "g2", ], )

Definition at line 477 of file testGroupUserFolderAPI.py.

00477 
00478     def test_userAddRole(self):
00479         self.gruf.userAddRole("u1", "r1", )
00480         self.gruf.userAddRole("u1", "r2", )
00481         self.compareRoles(None, "u1", ["r1", "r2", ], )

Here is the call graph for this function:

Definition at line 390 of file testGroupUserFolderAPI.py.

00390 
00391     def test_userFolderAddGroup(self):
00392         self.gruf.userFolderAddGroup(
00393             name = "created_group",
00394             roles = [],
00395             groups = [],
00396             )
00397         self.failUnless(self.gruf.getGroup("created_group"))
00398         self.gruf.userFolderAddGroup(
00399             name = "group_test_prefix",
00400             roles = [],
00401             groups = [],
00402             )
00403         self.failUnless(self.gruf.getGroup("group_test_prefix"))
00404         self.failUnless(self.gruf.getGroup("group_test_prefix").isGroup())
00405 
00406         # Prevent group_group_xxx names
00407         self.failUnless(self.gruf.getGroupById("group_group_test_prefix", None) is None)
        

Here is the call graph for this function:

Definition at line 739 of file testGroupUserFolderAPI.py.

00739 
00740     def test_userFolderAddRole(self):
00741         self.gruf.userFolderAddRole("r9")
00742         self.failUnless(
00743             "r9" in self.gruf.userFolderGetRoles(),
00744             )

Definition at line 337 of file testGroupUserFolderAPI.py.

00337 
00338     def test_userFolderAddUser(self):
00339         self.gruf.userFolderAddUser(
00340             name = "created_user",
00341             password = "secret",
00342             roles = [],
00343             groups = [],
00344             domains = (),
00345             )
00346         self.failUnless(self.gruf.getUser("created_user"))
00347         self.gruf.userFolderAddUser(
00348             name = "group_test_prefix",
00349             password = "secret",
00350             roles = [],
00351             groups = [],
00352             domains = (),
00353             )
00354         self.failUnless(self.gruf.getUser("group_test_prefix"))
00355         self.failIf(self.gruf.getUser("group_test_prefix").isGroup())
        

Here is the call graph for this function:

Definition at line 460 of file testGroupUserFolderAPI.py.

00460 
00461     def test_userFolderDelGroups(self):
00462         self.gruf.userFolderAddGroup(
00463             name = "created_group",
00464             roles = [],
00465             groups = [],
00466             )
00467         self.gruf.userFolderDelGroups(['created_group', ])
00468         self.failUnless(self.gruf.getGroup("created_group") is None)

We cannot create additional roles easily with LDAP...
So we don't test this.

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 284 of file testLDAPGroupFolder.py.

00284 
00285     def test_userFolderDelRoles(self,):
00286         """
00287         We cannot create additional roles easily with LDAP...
00288         So we don't test this.
00289         """
00290         pass
00291 
00292 

Definition at line 379 of file testGroupUserFolderAPI.py.

00379 
00380     def test_userFolderDelUsers(self):
00381         self.gruf.userFolderAddUser(
00382             name = "created_user",
00383             password = "secret",
00384             roles = [],
00385             domains = (),
00386             groups = [],
00387             )
00388         self.gruf.userFolderDelUsers(['created_user', ])
00389         self.failUnless(self.gruf.getUser("created_user") is None)

Definition at line 408 of file testGroupUserFolderAPI.py.

00408 
00409     def test_userFolderEditGroup(self):
00410         self.gruf.userFolderAddGroup(
00411             name = "created_group",
00412             roles = [],
00413             groups = [],
00414             )
00415         self.gruf.userFolderEditGroup(
00416             name = "created_group",
00417             roles = ["r1", ],
00418             groups = ["group_g1", ],
00419             )
00420         self.compareRoles(None, "created_group", ['r1',], )
00421         self.failUnless(
00422             "g1" in self.gruf.getGroupByName("created_group").getAllGroupNames(),
00423             self.gruf.getGroupByName("created_group").getAllGroupNames(),
00424             )
00425         self.gruf.userFolderEditGroup(
00426             name = "created_group",
00427             roles = ["r1", ],
00428             groups = ["g2", ],
00429             )
00430         self.failUnless(
00431             "g2" in self.gruf.getGroupByName("created_group").getAllGroupNames(),
00432             self.gruf.getGroupByName("created_group").getAllGroupNames(),
00433             )
        

Here is the call graph for this function:

Changed because of http://www.dataflake.org/tracker/issue_00376

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 359 of file testLDAPGroupFolder.py.

00359 
00360     def test_userFolderEditUser(self,):
00361         """Changed because of http://www.dataflake.org/tracker/issue_00376
00362         """
00363         self.gruf.userFolderEditUser(
00364             name = "u1",
00365             password = "secret2",
00366             roles = ["r1", ],
00367             groups = ["g1", ],
00368             )
00369         self.compareRoles(None, "u1", ['r1', "g1", ], )

Here is the call graph for this function:

Test existing roles

Definition at line 720 of file testGroupUserFolderAPI.py.

00720 
00721     def test_userFolderGetRoles(self,):
00722         """
00723         Test existing roles
00724         """
00725         should_be =  [
00726             'Anonymous',
00727             'Authenticated',
00728             'Manager',
00729             'Owner',
00730             'r1',
00731             'r2',
00732             'r3',
00733             'test_role_1_',
00734             ]
00735         should_be.sort()
00736         roles = list(self.gruf.userFolderGetRoles())
00737         roles.sort()
00738         self.failUnless(roles == should_be)

Definition at line 434 of file testGroupUserFolderAPI.py.

00434 
00435     def test_userFolderUpdateGroup(self):
00436         self.gruf.userFolderAddGroup(
00437             name = "created_group",
00438             roles = [],
00439             groups = [],
00440             )
00441         self.gruf.userFolderUpdateGroup(
00442             name = "created_group",
00443             roles = ["r1", ],
00444             groups = ["group_g1", ],
00445             )
00446         self.compareRoles(None, "created_group", ['r1',], )
00447         self.failUnless(
00448             "g1" in self.gruf.getGroupByName("created_group").getAllGroupNames(),
00449             self.gruf.getGroupByName("created_group").getAllGroupNames(),
00450             )
00451         self.gruf.userFolderUpdateGroup(
00452             name = "created_group",
00453             roles = ["r1", ],
00454             groups = None,
00455             )
00456         self.failUnless(
00457             "g1" in self.gruf.getGroupByName("created_group").getAllGroupNames(),
00458             self.gruf.getGroupByName("created_group").getAllGroupNames(),
00459             )

Here is the call graph for this function:

Definition at line 366 of file testGroupUserFolderAPI.py.

00366 
00367     def test_userFolderUpdateUser(self):
00368         self.gruf.userFolderUpdateUser(
00369             name = "u5",
00370             roles = ["r2", ],
00371             )
00372         self.compareRoles(None, "u5", ['r1', 'r2',], )
00373         self.compareGroups("u5", ['g2', 'g3'], )
00374         self.gruf.userFolderUpdateUser(
00375             name = "u6",
00376             roles = None,
00377             )
00378         self.compareRoles(None, "u6", ['r1', 'r2', ], )

Here is the call graph for this function:

Definition at line 509 of file testGroupUserFolderAPI.py.

00509 
00510     def test_userGetDomains(self):
00511         ""

Definition at line 526 of file testGroupUserFolderAPI.py.

00526 
00527     def test_userRemoveDomain(self):
00528         ""

Remove the group of a user atom

Definition at line 558 of file testGroupUserFolderAPI.py.

00558 
00559     def test_userRemoveGroup(self):
00560         """Remove the group of a user atom
00561         """
00562         self.gruf.userFolderAddUser(
00563             name = "created_user",
00564             password = "secret",
00565             groups = ["g2", "g1", ],
00566             domains = (),
00567             roles = (),
00568             )
00569         self.gruf.userRemoveGroup("created_user", "g1", )
00570         self.compareGroups("created_user", ["g2", ], )

Remove the role of a user atom

Definition at line 482 of file testGroupUserFolderAPI.py.

00482 
00483     def test_userRemoveRole(self):
00484         """Remove the role of a user atom
00485         """
00486         self.gruf.userSetRoles("u1", ["r1", "r2", ], )
00487         self.compareRoles(None, "u1", ["r1", "r2", ], )
00488         self.gruf.userRemoveRole("u1", "r1", )
00489         self.compareRoles(None, "u1", ["r2", ], )

Here is the call graph for this function:

LDAPUF has no domain support

Reimplemented from GroupUserFolder.tests.testGroupUserFolderAPI.TestGroupUserFolderAPI.

Definition at line 188 of file testLDAPUserFolder.py.

00188 
00189     def test_userSetDomains(self,):
00190         """
00191         LDAPUF has no domain support
00192         """
00193         pass

Definition at line 529 of file testGroupUserFolderAPI.py.

00529 
00530     def test_userSetGroups(self):
00531         # Test user
00532         self.gruf.userFolderAddUser(
00533             name = "created_user",
00534             password = "secret",
00535             domains = (),
00536             roles = (),
00537             groups = [],
00538             )
00539         self.gruf.userSetGroups("created_user", ["g1", "g2", ], )
00540         self.compareGroups("created_user", ["g1", "g2", ], )
00541         self.gruf.userSetGroups("created_user", [], )
00542         self.compareGroups("created_user", [], )

Test user password setting

Definition at line 490 of file testGroupUserFolderAPI.py.

00490 
00491     def test_userSetPassword(self):
00492         """Test user password setting
00493         """
00494         # Regular user password
00495         user = self.gruf.getUser('u1')
00496         self.failUnless(self.gruf.authenticate("u1", 'secret', self.app.REQUEST))
00497         self.gruf.userSetPassword("u1", "bloub")
00498         user = self.gruf.getUser('u1')
00499         self.failUnless(not self.gruf.authenticate("u1", 'secret', self.app.REQUEST))
00500         self.failUnless(self.gruf.authenticate("u1", 'bloub', self.app.REQUEST))
00501 
00502         # Group password changing must fail
00503         try: self.gruf.userSetPassword("g1", "bloub")
00504         except ValueError: pass                # ok
00505         else: raise "AssertionError", "Should raise"
00506         try: self.gruf.userSetPassword("group_g1", "bloub")
00507         except ValueError: pass                # ok
00508         else: raise "AssertionError", "Should raise"

Definition at line 471 of file testGroupUserFolderAPI.py.

00471 
00472     def test_userSetRoles(self):
00473         self.gruf.userSetRoles("u1", ["r1", "r2", ], )
00474         self.compareRoles(None, "u1", ["r1", "r2", ], )
00475         self.gruf.userSetRoles("u1", [], )
00476         self.compareRoles(None, "u1", [], )

Here is the call graph for this function:

Ensure that LDAPGroupFolder will still work correctly if we move
a source. This caused core dumps or GRUF3Beta1.

Definition at line 227 of file testLDAPGroupFolder.py.

00227 
00228     def testLDAPSourceMove(self,):
00229         """Ensure that LDAPGroupFolder will still work correctly if we move
00230         a source. This caused core dumps or GRUF3Beta1.
00231         """
00232         # Initial conditions
00233         self.failUnlessEqual(
00234             self.gruf.Users.acl_users.meta_type,
00235             "LDAPUserFolder",
00236             )
00237 
00238         # Add & swap
00239         self.gruf.addUserSource(
00240             "manage_addProduct/OFSP/manage_addUserFolder",
00241             )
00242         self.gruf.moveUserSourceUp("Users01")
00243         self.failUnlessEqual(
00244             self.gruf.Users.acl_users.meta_type,
00245             "User Folder",
00246             )
00247 
00248         # Stress it
00249         self.gruf.getUsers()
00250         self.gruf.getUserNames()
00251 
00252         # Put it back again
00253         self.gruf.moveUserSourceUp("Users01")
00254 
00255         # Stress it again
00256         self.gruf.getUsers()
00257         self.gruf.getUserNames()
00258 


Member Data Documentation

Definition at line 95 of file GRUFTestCase.py.

Definition at line 95 of file GRUFTestCase.py.

Definition at line 93 of file GRUFTestCase.py.

Definition at line 93 of file GRUFTestCase.py.

Initial value:
(        # tell which classes to check
        GroupUserFolder.GroupUserFolder,
        )

Definition at line 62 of file testGroupUserFolderAPI.py.

Definition at line 242 of file GRUFTestCase.py.

Definition at line 242 of file GRUFTestCase.py.

Definition at line 243 of file GRUFTestCase.py.

Definition at line 243 of file GRUFTestCase.py.

Definition at line 244 of file GRUFTestCase.py.

Definition at line 244 of file GRUFTestCase.py.

Definition at line 245 of file GRUFTestCase.py.

Definition at line 245 of file GRUFTestCase.py.

Definition at line 246 of file GRUFTestCase.py.

Definition at line 246 of file GRUFTestCase.py.

Definition at line 247 of file GRUFTestCase.py.

Definition at line 247 of file GRUFTestCase.py.


The documentation for this class was generated from the following file: