Пример #1
0
    def share_to_user(self, user_name: str, type: DataPermissionType):
        """
        共享数据给指定用户

        Args:
            user_name: 用户名
            type: 共享权限

        Returns:

        """
        entity = IportalDataAuthorizeEntity()
        entity.dataPermissionType = type.value
        entity.entityType = EntityType.USER
        entity.entityName = user_name
        self._settings.append(entity)
        return self
Пример #2
0
    def share_to_everyone(self, type: DataPermissionType):
        """
        共享数据给所有人

        Args:
            type: 共享权限

        Returns:

        """
        entity = IportalDataAuthorizeEntity()
        entity.dataPermissionType = type.value
        entity.entityType = EntityType.USER
        entity.entityName = 'GUEST'
        entity.aliasName = 'GUEST'
        self._settings.append(entity)
        return self
Пример #3
0
    def share_data(self, data_id: str, is_public: bool):
        """
        共享数据

        Args:
            data_id: 数据id
            is_public: 是否公开
        """
        setting = OnlineDataShareSetting()
        setting.ids = [data_id]
        if is_public:
            entity = IportalDataAuthorizeEntity()
            entity.dataPermissionType = DataPermissionType.DOWNLOAD
            entity.entityType = EntityType.USER
            entity.entityName = 'GUEST'
            entity.aliasName = 'GUEST'
            setting.entities = [entity]
        else:
            setting.entities = []
        self._online.datas_service().put_sharesetting(entity=setting)