This file is indexed.

/usr/lib/python2.7/dist-packages/kopano/permission.py is in python-kopano 8.5.5-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"""
Part of the high-level python bindings for Kopano.

Copyright 2005 - 2016 Zarafa and its licensors (see LICENSE file for details)
Copyright 2016 - Kopano and its licensors (see LICENSE file for details)
"""

from MAPI import MAPI_UNICODE, ROW_MODIFY
from MAPI.Struct import MAPIErrorNotFound, ROWENTRY, SPropValue
from MAPI.Tags import PR_MEMBER_ENTRYID, PR_MEMBER_RIGHTS, PR_MEMBER_ID

from .compat import repr as _repr
from .defs import RIGHT_NAME, NAME_RIGHT
from .errors import NotFoundError

class Permission(object):
    """Permission class"""

    def __init__(self, mapitable, mapirow, server): # XXX fix args
        self.mapitable = mapitable
        self.mapirow = mapirow
        self.server = server

    @property
    def member(self): # XXX company?
        """:class:`User <User>` or :class:`group <Group>` given specific rights."""
        try:
            return self.server.user(self.server.sa.GetUser(self.mapirow[PR_MEMBER_ENTRYID], MAPI_UNICODE).Username)
        except (NotFoundError, MAPIErrorNotFound):
            return self.server.group(self.server.sa.GetGroup(self.mapirow[PR_MEMBER_ENTRYID], MAPI_UNICODE).Groupname)

    @property
    def rights(self):
        """Rights given to member.

        Possible rights:

        read_items, create_items, create_subfolders, edit_own, edit_all,
        delete_own, delete_all, folder_owner, folder_contact, folder_visible
        """
        r = []
        for right, name in RIGHT_NAME.items():
            if self.mapirow[PR_MEMBER_RIGHTS] & right:
                r.append(name)
        return r

    @rights.setter
    def rights(self, value):
        r = 0
        for name in value:
            try:
                r |= NAME_RIGHT[name]
            except KeyError:
                raise NotFoundError("no such right: '%s'" % name)

        self.mapitable.ModifyTable(0, [ROWENTRY(ROW_MODIFY, [SPropValue(PR_MEMBER_ID, self.mapirow[PR_MEMBER_ID]), SPropValue(PR_MEMBER_ENTRYID, self.mapirow[PR_MEMBER_ENTRYID]), SPropValue(PR_MEMBER_RIGHTS, r)])]) # PR_MEMBER_ID needed, or it becomes ROW_ADD

    def __unicode__(self):
        return u"Permission('%s')" % self.member.name

    def __repr__(self):
        return _repr(self)