🔍 Code Extractor

class CalendarRoleType

Maturity: 32

An enumeration-style class that defines calendar role types and permission levels for calendar sharing in a calendar management system.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/role_type.py
Lines:
1 - 29
Complexity:
simple

Purpose

CalendarRoleType serves as a constants container that defines different permission levels for calendar access and sharing. It provides integer constants representing various roles from no access to full delegate access with private event visibility. This class is typically used to check or set user permissions when sharing calendars, determining what level of access a user has to another user's calendar events.

Source Code

class CalendarRoleType:
    def __init__(self):
        pass

    none = 0
    """Calendar is not shared with the user."""

    freeBusyRead = 1
    """User is a sharee who can view free/busy status of the owner on the calendar."""

    limitedRead = 2
    """User is a sharee who can view free/busy status, and titles and locations of the events on the calendar."""

    read = 3
    """User is a sharee who can view all the details of the events on the calendar, except for the owner's private
    events."""

    write = 4
    """User is a sharee who can view all the details (except for private events) and edit events on the calendar."""

    delegateWithoutPrivateEventAccess = 5
    """User is a delegate who has write access but cannot view information of the owner's private events on the
    calendar."""

    delegateWithPrivateEventAccess = 6
    """User is a delegate who has write access and can view information of the owner's private events on the calendar"""

    custom = 7
    """User has custom permissions to the calendar."""

Parameters

Name Type Default Kind
bases - -

Parameter Details

__init__: The constructor takes no parameters and performs no initialization. It exists only to allow instantiation of the class, though the class is primarily used for its class-level constants rather than instances.

Return Value

Instantiation returns a CalendarRoleType object with no instance-specific state. The class is designed to be used primarily through its class-level integer constants (none, freeBusyRead, limitedRead, read, write, delegateWithoutPrivateEventAccess, delegateWithPrivateEventAccess, custom) which represent different permission levels.

Class Interface

Methods

__init__(self)

Purpose: Initializes a CalendarRoleType instance with no state

Returns: None - constructor returns a CalendarRoleType instance

Attributes

Name Type Description Scope
none int Value 0 - Calendar is not shared with the user, no access permissions class
freeBusyRead int Value 1 - User can view only free/busy status of the owner on the calendar class
limitedRead int Value 2 - User can view free/busy status, titles, and locations of events on the calendar class
read int Value 3 - User can view all event details except the owner's private events class
write int Value 4 - User can view all details (except private events) and edit events on the calendar class
delegateWithoutPrivateEventAccess int Value 5 - User is a delegate with write access but cannot view the owner's private events class
delegateWithPrivateEventAccess int Value 6 - User is a delegate with write access and can view the owner's private events class
custom int Value 7 - User has custom permissions to the calendar class

Usage Example

# Access class constants directly without instantiation
if user_role == CalendarRoleType.read:
    print("User can view all event details except private events")

# Set calendar permission level
calendar_permission = CalendarRoleType.write

# Check permission level
if calendar_permission >= CalendarRoleType.write:
    allow_event_editing()

# Compare permission levels
if user_permission > CalendarRoleType.freeBusyRead:
    show_event_details()

# Use in permission checking function
def can_view_private_events(role_type):
    return role_type == CalendarRoleType.delegateWithPrivateEventAccess

# Instantiation (though not typically necessary)
role_type_instance = CalendarRoleType()
print(role_type_instance.read)  # Outputs: 3

Best Practices

  • Use the class constants directly without instantiating the class (e.g., CalendarRoleType.read instead of creating an instance)
  • The integer values are ordered by permission level, allowing for comparison operations (e.g., role >= CalendarRoleType.write)
  • Consider using Python's enum.IntEnum instead for better type safety and IDE support in modern implementations
  • The constants are immutable and should never be modified at runtime
  • Use these constants consistently throughout your codebase for calendar permission checks to maintain clarity
  • Document which permission level is required for each calendar operation in your application

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class RoleType 70.9% similar

    An enumeration class that defines SharePoint role types with integer constants representing different permission levels for users and groups.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/role_type.py
  • class CalendarType 63.4% similar

    An enumeration class that defines calendar type constants as specified in Microsoft SharePoint protocols [MS-WSSFO2] and [MS-WSSFO3].

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/webs/calendar_type.py
  • class CalendarPermission 63.3% similar

    Represents permissions for a user with whom an Outlook calendar has been shared or delegated, providing read-only access to permission details and role management.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/permissions/permission.py
  • class Role 62.5% similar

    An enumeration class representing abstract roles for SharePoint sharing permissions on securable objects in document libraries.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/role.py
  • class CalendarPermissionCollection 61.0% similar

    A collection class for managing CalendarPermission entities, providing methods to add and manage permissions for calendar sharing and delegation in Microsoft 365/Outlook.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/permissions/collection.py
← Back to Browse