U
    juic                     @   s   d dl Z d dlmZ d dlmZ d dlmZmZ d dlZd dlZd dl	m
Z
 d dlmZ d dlT d dlmZ d d	lmZmZmZ G d
d deZdS )    N)copy)uuid4)urlparseparse_qs)cmfutil)commit_all_ds)*)BaseView)ApiViewCmfResultSplittermemoizedc                       s>   e Zd ZdZdd ZedddZejj	 fddZ
  ZS )	PublicApiViewz/pub/apic                 C   s0   t dt j  t jr,t js,t d dS dS )Nu-   Доступ к публичному апи: uK   Доступ к share-api не прошел проверку sharelink_hashFT)gdebugZcurrent_personZsharelink_access_requestZsharelink_access_grantedself r   !./modules/api/views/public_api.py_check_access   s
    
zPublicApiView._check_access)methodc                 O   s  z|j ddd\}}W n tk
r,   Y dS X |ds<dS || jkrJdS d}|dkrh| jd d d	 }|d
kr| jd d d }|dkr| jd d d }|dkr| jd d d }|dkr| jd d d }|dkr| jd d d }|dkr| jd d d }|dkr"| jd d d }|dkr>| jd d d }|dkrZ| jd d d }|d krv| jd! d d" }|d#kr| jd d d" }|d$kr| jd% d d" }|d&kr| jd' d d" }|d(kr| jd) d d* }|d+kr| jd d d, }|d-kr| jd. d d/ }|d0kr:| jd! d d1 }|d2krV| jd) d d1 }|d3krr| jd d d4 }|s|dS | j| d5 |d5< d6}||d7< |S )8u9  
        def rpc_prepare_method():
            #Проскси-методы
            if method == „PersonVar.public_ping“:
                method = PersonVar.ping
            # Спец.методы
            if method == „PersonVar.public_set“:
                method = PersonVar.public_set
        .   )maxsplitNZpublic_z!CmfPerson.public_get_current_userZ	CmfPersonmethodsZget_current_userz BaseModel.public_all_models_metaZ	BaseModelZall_models_metaz!BaseModel.public_get_ui_full_pathZget_ui_full_pathz$CmfMenuTree.public_tree_menu_in_rootZCmfMenuTreeZtree_menu_in_rootzCmfMenuTree.public_get_nodeZget_nodez#CmfMenuTree.public_get_parents_listZget_parents_listzCmfAttachment.public_listZCmfAttachmentlistzCmfDocument.public_listZCmfDocumentzCmfComment.public_listZ
CmfCommentzCmfPersonVar.public_getZCmfPersonVargetzCmfProject.public_getZ
CmfProjectZ
public_getzCmfDocument.public_getzCmfFolder.public_getZ	CmfFolderzCmfList.public_getZCmfListz%CmfGlobalSettings.public_get_settingsZCmfGlobalSettingsZpublic_get_settingszCmfMenuTree.public_get_treeZpublic_get_treezCmfLicense.public_listZ
CmfLicenseZpublic_list_hack_emptyzCmfProject.public_listZpublic_listzCmfGlobalSettings.public_listz&CmfPersonVar.public_update_recents_objZpublic_update_recents_objZ_classFZ_use_simple)split
ValueError
startswithZrpc)r   r   argskwargsZproc_cls_nameZproc_methodZ
res_methodZ
use_simpler   r   r   rpc_prepare_method   sn    
















z PublicApiView.rpc_prepare_methodc                    s
   t   S )N)superpostr   	__class__r   r   r#   w   s    zPublicApiView.post)__name__
__module____qualname__Z__url__r   strr!   ZcmfZviewsactionr#   __classcell__r   r   r$   r   r      s
   Yr   )	tracebackr   Zuuidr   Zurllib.parser   r   ZhashlibZujsonZcmf.utilr   Zcmf.data_providers.baser   Zcmf.includeZ	cmf.viewsr	   Zmodules.api.views.indexr
   r   r   r   r   r   r   r   <module>   s   