当前位置: 首页>>代码示例>>Python>>正文


Python DCC.print_perm方法代码示例

本文整理汇总了Python中DCC.print_perm方法的典型用法代码示例。如果您正苦于以下问题:Python DCC.print_perm方法的具体用法?Python DCC.print_perm怎么用?Python DCC.print_perm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DCC的用法示例。


在下文中一共展示了DCC.print_perm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: id_perm_changes

# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import print_perm [as 别名]
def id_perm_changes(s, handle, fd, permdata, set):
    removelist = []
    changelist = []
    addlist = []
       
    if not check_fd_sel(fd, set) or not check_perm_sel(permdata, set):
        return([removelist,changelist,addlist])
    
    for perm_act in set['PermAct']:
        # pass if no action is defined
        if not perm_act['Action']:
            pass
        elif perm_act['Action']['Action'] == 'Remove':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    removelist.append(perm)
        elif perm_act['Action']['Action'] == 'Change':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    # delete the old permission
                    newperm = perm.copy()
                    if 'Read' in perm: del(newperm['Read'])
                    if 'Write'in perm: del(newperm['Write'])
                    if 'Manage' in perm: del(newperm['Manage'])
                    for key,val in perm_act['Action']['Perms'].items():
                        newperm[key] = val
                    changelist.append(newperm)  
        elif perm_act['Action']['Action'] == 'Add':
            addFlag = True
            for perm in permdata['perms']:
                if not Match.parse(perm_act['Criteria'], perm):
                    addFlag = False
            if addFlag:
                pEntry = {}
                pEntry['handle'] = perm_act['Action']['Handle']
                grpdata = DCC.prop_get(s, pEntry['handle'], InfoSet = 'Title')
                pEntry['name'] = grpdata['title']
                if 'Read' in perm_act['Action']['Perms']:
                    pEntry['Read'] = perm_act['Action']['Perms']['Read']
                if 'Write' in perm_act['Action']['Perms']:
                    pEntry['Write'] = perm_act['Action']['Perms']['Write']
                if 'Manage' in perm_act['Action']['Perms']:
                    pEntry['Manage'] = perm_act['Action']['Perms']['Manage']
                addlist.append(pEntry) 
                
        elif perm_act['Action']['Action'] == 'Message':
            for perm in permdata['perms']:
                if Match.parse(perm_act['Criteria'], perm):
                    print(perm_act['Action']['Message'])
                    DCC.print_perm(perm, LF = True)
        
    return([removelist, changelist, addlist])
开发者ID:TMTSystemsEngineering,项目名称:Library,代码行数:54,代码来源:PERM.py

示例2: print_perm_changes

# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import print_perm [as 别名]
def print_perm_changes(removelist, changelist, addlist):
    for perm in removelist:
        print('??? Remove ??? :',end='')
        DCC.print_perm(perm,LF=True)
    for perm in changelist:
        print('??? Change ??? :',end='')
        DCC.print_perm(perm,LF=True)
    for perm in addlist:
        print('??? Add ??? :',end='')
        DCC.print_perm(perm,LF=True)
    print()
开发者ID:pbbarnes,项目名称:Library1,代码行数:13,代码来源:PERM.py

示例3: make_perm_changes

# 需要导入模块: import DCC [as 别名]
# 或者: from DCC import print_perm [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_perm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。