Jump to content

How can i restrict time logger deletion i tried below code and found the exact events but dont know what next to do?.. please find the below code


dipesh merchant

Recommended Posts

entities = event['data'].get('entities', [])
    logging.info(entities)
    if (
        len(entities) == 1 and
        entities[0]['action'] == 'remove' and
        entities[0]['entityType'] == 'timelog'
    ):
        event = ftrack_api.event.base.Event(
                    topic='ftrack.action.trigger-user-interface',
                    data={
                        'type''message',
                        'success' :False,
                        'message' : 'you are not allowed to delete the timelog'
                    },
                    target=(
                        'applicationId=ftrack.client.web and '
                        'user.id={0}'.format(
                            event['source']['user']['id']
                        )
                    )
                )
 
    session.event_hub.publish(event)
 
session.event_hub.subscribe('topic=ftrack.update'print_event)
session.event_hub.wait()
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...