コード例 #1
0
ファイル: test_zimbra_mail.py プロジェクト: zacbri/zimsoap
    def get_multi_permissions(self):
        admin_zc = ZimbraAdminClient(
            TEST_CONF['host'], TEST_CONF['admin_port']
        )
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

        right = 'sendAs'

        self.zc.grant_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user2']
        )
        self.zc.grant_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user3']
        )
        perm = self.zc.get_permissions()
        self.assertTrue(len(perm['ace']), 2)

        self.zc.revoke_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user2']
        )
        self.zc.revoke_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user3']
        )
コード例 #2
0
ファイル: test_zimbra_account.py プロジェクト: zacbri/zimsoap
    def test_get_share_info(self):

        # No shares yes
        shares = self.zc.get_share_info()
        self.assertEqual(shares, [])

        # Create share
        admin_zc = ZimbraAdminClient(TEST_CONF['host'],
                                     TEST_CONF['admin_port'])
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])
        mail_zc2 = ZimbraMailClient(
            TEST_CONF['host'], TEST_CONF['webmail_port'])
        mail_zc2.delegated_login(TEST_CONF['lambda_user2'], admin_zc)

        mail_zc2.modify_folder_grant(
                folder_ids=['1'],
                grantee_name=TEST_CONF['lambda_user'],
                perm='rwixd',
                gt='usr'
            )

        shares = self.zc.get_share_info()
        self.assertEqual(shares[0]['ownerEmail'], TEST_CONF['lambda_user2'])

        # Clean
        mail_zc2.modify_folder_grant(
                folder_ids=['1'],
                zid=admin_zc.get_account(
                    Account(name=TEST_CONF['lambda_user'])).id,
                perm='none',
                gt='usr'
            )
コード例 #3
0
ファイル: test_zimbra_mail.py プロジェクト: zacbri/zimsoap
    def test_account_delegated_login(self):
        admin_zc = ZimbraAdminClient(TEST_CONF['host'],
                                     TEST_CONF['admin_port'])
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

        new_zc = ZimbraMailClient(TEST_CONF['host'])
        new_zc.delegated_login(TEST_CONF['lambda_user'], admin_zc)

        self.assertTrue(new_zc._session.is_logged_in())
        self.assertTrue(new_zc.is_session_valid())
コード例 #4
0
ファイル: test_zimbra_mail.py プロジェクト: zacbri/zimsoap
    def test_folder_grant_mount_revoke(self):
        admin_zc = ZimbraAdminClient(TEST_CONF['host'],
                                     TEST_CONF['admin_port'])
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

        grantee_zc = ZimbraMailClient(TEST_CONF['host'])
        grantee_zc.delegated_login(TEST_CONF['lambda_user2'], admin_zc)

        grantee_id = admin_zc.get_account(
            Account(name=TEST_CONF['lambda_user2'])
        )._a_tags['zimbraId']

        right = 'rwidx'
        self.zc.modify_folder_grant(
            folder_ids=['1'],
            perm=right,
            zid=grantee_id
        )

        f_gt = self.zc.get_folder_grant(path='/')
        self.assertEqual(f_gt['grant']['perm'], right)
        self.assertEqual(f_gt['grant']['d'], TEST_CONF['lambda_user2'])

        mount_name = 'MountedZimsoapTest'
        grantee_zc.create_mountpoint(
            name=mount_name,
            path='/',
            owner=TEST_CONF['lambda_user'],
            l='1'
        )
        mount_path = '/' + mount_name
        link = grantee_zc.get_mountpoint(path=mount_path)['link']
        self.assertEqual(link['name'], mount_name)
        self.assertEqual(link['owner'], TEST_CONF['lambda_user'])

        # Clean grantee
        grantee_zc.delete_mountpoints(folder_ids=[link['id']])

        # Revoke rights
        self.zc.modify_folder_grant(
            folder_ids=['1'],
            perm='none',
            zid=grantee_id
        )
        f_gt = self.zc.get_folder_grant(path='/')
        self.assertEqual(f_gt, {})
コード例 #5
0
ファイル: test_zimbra_mail.py プロジェクト: zacbri/zimsoap
    def test_grant_get_revoke_permission(self):
        admin_zc = ZimbraAdminClient(
            TEST_CONF['host'], TEST_CONF['admin_port']
        )
        admin_zc.login(TEST_CONF['admin_login'], TEST_CONF['admin_password'])

        right = 'sendAs'

        self.zc.grant_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user2']
        )

        perm = self.zc.get_permissions([right])
        self.assertTrue(perm['ace'][0]['d'], TEST_CONF['lambda_user2'])

        self.zc.revoke_permission(
            right=right,
            grantee_name=TEST_CONF['lambda_user2']
        )
        perm = self.zc.get_permissions([right])
        self.assertEqual(perm, {'ace': []})
コード例 #6
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
 def test_admin_get_logged_in_by(self):
     new_zc = ZimbraAdminClient(self.HOST, self.ADMIN_PORT)
     new_zc.get_logged_in_by(self.ADMIN_LOGIN, self.zc)
     self.assertTrue(new_zc._session.is_logged_in())
     self.assertTrue(new_zc.is_session_valid())
コード例 #7
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
 def testBadPortFailure(self):
     with self.assertRaises(URLError):
         zc = ZimbraAdminClient(self.TEST_SERVER, 9999)
         zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)
コード例 #8
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
 def testBadHostFailure(self):
     with self.assertRaises(URLError):
         zc = ZimbraAdminClient('nonexistanthost.example.com',
                                self.TEST_ADMIN_PORT)
         zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)
コード例 #9
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
    def testBadPasswordFailure(self):
        with self.assertRaises(ZimbraSoapServerError) as cm:
            zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
            zc.login(self.TEST_LOGIN, 'badpassword')

        self.assertIn('authentication failed', cm.exception.msg)
コード例 #10
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
    def testBadLoginFailure(self):
        with self.assertRaises(ZimbraSoapServerError) as cm:
            zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
            zc.login('*****@*****.**', self.TEST_PASSWORD)

        self.assertIn('authentication failed', cm.exception.msg)
コード例 #11
0
ファイル: test_zimbra_admin.py プロジェクト: zacbri/zimsoap
 def testLogin(self):
     zc = ZimbraAdminClient(self.TEST_SERVER, self.TEST_ADMIN_PORT)
     zc.login(self.TEST_LOGIN, self.TEST_PASSWORD)
     self.assertTrue(zc._session.is_logged_in())