當前位置: 首頁>>代碼示例>>Python>>正文


Python DCC.print_perms方法代碼示例

本文整理匯總了Python中DCC.print_perms方法的典型用法代碼示例。如果您正苦於以下問題:Python DCC.print_perms方法的具體用法?Python DCC.print_perms怎麽用?Python DCC.print_perms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DCC的用法示例。


在下文中一共展示了DCC.print_perms方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fix_set

# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import print_perms [as 別名]
def fix_set(s, handle, set, **kwargs):
    # kwargs
    #   ask = True | False, Do/Don't ask if changes should be made (!!! Dangerous !!!)
    #   default is ask

    if 'Document-' in handle:
        fd = DCC.prop_get(s, handle, InfoSet = 'DocBasic')
    elif 'Collection-' in handle:
        fd = DCC.prop_get(s, handle, InfoSet = 'CollData')
    else:
        fd = DCC.prop_get(s, handle, InfoSet = 'Title')    
    permdata = DCC.prop_get(s, handle, InfoSet = 'Perms')
    print(fd['handle'], ':', fd['title']) 
    
    fd['permissions'] = permdata
    [removelist, changelist, addlist] = id_perm_changes(s,handle, fd, permdata, set) 
    ch_flag = False
    if len(removelist) or len(changelist) or len(addlist):
        print('\n##############       ENTRY       ##############')
        if 'Document-' in handle:
            DCC.print_doc_basic(fd)
        elif 'Collection-' in handle:
            DCC.print_coll_data(fd)
        else:
            print('Not Document or Collection:', handle, ':', fd['title'])   
        print('https://docushare.tmt.org/docushare/dsweb/ServicesLib/',handle,'/Permissions',sep='')
        DCC.print_perms(permdata)    
        print('\nSuggested Changes...')
        print_perm_changes(removelist, changelist, addlist)
        make_perm_changes(s, handle, permdata, removelist, changelist, addlist, **kwargs)
開發者ID:pbbarnes,項目名稱:Library1,代碼行數:32,代碼來源:PERM.py

示例2: modify_dcc_perms

# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import print_perms [as 別名]
def modify_dcc_perms(s, handle, permdata, **kwargs):
    ask_flag = kwargs.get('Ask',True)
    print('\n   Modifying Permissions to:',handle)
    DCC.print_perms(permdata)       
    if ask_flag == False or MyUtil.get_yn('Change Permissions (Y/N)?'):
        print('Changing permissions...')
        DCC.set_permissions(s, handle, permdata)
開發者ID:pbbarnes,項目名稱:Library1,代碼行數:9,代碼來源:PERM.py

示例3: fix_permact

# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import print_perms [as 別名]
def fix_permact(s, fd, handle, set, **kwargs):
    # kwargs
    #   ask = True | False, Do/Don't ask if changes should be made (!!! Dangerous !!!)
    #   default is ask

    [removelist, changelist, addlist] = id_perm_changes(s,handle, fd, fd['permissions'], set) 
    ch_flag = False
    if len(removelist) or len(changelist) or len(addlist):

        DCC.print_perms(fd['permissions'])    
        print('\nSuggested Changes...')
        print_perm_changes(removelist, changelist, addlist)
        make_perm_changes(s, handle, fd['permissions'], removelist, changelist, addlist, **kwargs)
開發者ID:TMTSystemsEngineering,項目名稱:Library,代碼行數:15,代碼來源:PERM.py

示例4: make_perm_changes

# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import print_perms [as 別名]
def make_perm_changes(s, handle, permdata, removelist, changelist, addlist, **kwargs):
    ask_flag = kwargs.get('Ask',True)
    mod_flag = False
    
    if ask_flag == True:
        ans = MyUtil.get_all_none_indiv('Make Changes? All/None/Individual (A/N/I)?')
        if ans == 'All':
            ask_flag = False
        elif ans == 'None':
            return
    
    for perm in removelist:
        print('Remove?: ',end='')
        DCC.print_perm(perm) 
        if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
            if ask_flag == False: print()
            mod_flag = True
            MyUtil.remove_dict_from_list(permdata['perms'],'handle',perm['handle'])

    for chperm in changelist:
        print('Change?:', end='')
        DCC.print_perm(chperm) 
        if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
            if ask_flag == False: print()
            mod_flag = True
            for perm in permdata['perms']:
                if perm['handle'] == chperm['handle']:
                    if 'Read' in perm: del(perm['Read'])
                    if 'Write'in perm: del(perm['Write'])
                    if 'Manage' in perm: del(perm['Manage'])
                    for key,val in chperm.items():
                        perm[key] = val
                              
    for addperm in addlist:
        print('Add?:', end='')
        DCC.print_perm(addperm)    
        if ask_flag == False or MyUtil.get_yn(': (Y/N)?'):
            if ask_flag == False: print()
            mod_flag = True
            permdata['perms'].append(addperm)
        if debug: DCC.print_perms(permdata)
    
    if mod_flag:
        # check ask_flag since it may have been modified from kwargs value
        if ask_flag == False:
            modify_dcc_perms(s, handle, permdata, Ask=False)
        else:
            modify_dcc_perms(s,handle,permdata, **kwargs)
開發者ID:pbbarnes,項目名稱:Library1,代碼行數:50,代碼來源:PERM.py


注:本文中的DCC.print_perms方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。