useraccess.sh
来自「CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KS」· Shell 代码 · 共 159 行
SH
159 行
#!/bin/ksh# begin_generated_IBM_prolog # # This is an automatically generated prolog - please make careful # modifications - update year1 and add program (product) numbers # if old copyright information exists in the file. Do not remove # any text. # ------------------------------------------------------------------ # IBM Confidential # # OCO Source Materials # # Product(s): CMVC951-7 # # (C)Copyright IBM Corp. 1999, 1999 # # The source code for this program is not published or otherwise # divested of its trade secrets, irrespective of what has been # deposited with the US Copyright Office. # ------------------------------------------------------------------ # end_generated_IBM_prolog ## SAMPLE NAME: userAccess## FUNCTIONS: This sample shell script lists the explicit access of a# specified userLogin for the specified component and its# descendant components.## USAGE: userAccess userLogin componentName## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [CMVC_BECOME]## ORIGINS: 27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1993# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1993# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.### NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU. SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines# Corporation.## /usr/lpp/cmvc/samples/userAccess#if [ $# -eq 0 ]; then echo "\nusage: $0 userLogin componentName\n" echo "This sample shell script lists the explicit access of a specified" echo "userLogin for the specified component and its descendant components.\n" exit 1fiif [ $# -ne 2 ]; then echo "" echo "Specify the userLogin and the componentName as arguments to the" echo "sample script.\n" exit 1fiif [ -z "$CMVC_FAMILY" ]then echo "The CMVC family must be set with the CMVC_FAMILY environment variable." exit 1ficleanup(){ rm -f $ACCESS 2>/dev/null}trap 'echo "\n$0: Interrupted."; cleanup; exit 1' 2 3 15ACCESS=/tmp/acc$$user=$1found=0Report -view Users -wh "login='$1'" -raw >/tmp/cv$$while read linedo COMPNAME=`echo $line | cut -d'|' -f1 ` found=1done </tmp/cv$$if [ $found -ne 1 ]then echo "\nUser, $1, was not found in the specified family.\n" exit 1fifound=0Report -view CompView -wh "name='$2'" -raw >/tmp/cv$$while read linedo COMPNAME=`echo $line | cut -d'|' -f1 ` found=1done </tmp/cv$$if [ $found -ne 1 ]then echo "\nComponent, $2, was not found in the specified family.\n" exit 1fiechoReport -vi AccessDownView -w "compName='$2'" -raw |awk -F"|" '{ if ($2 == "'$user'") printf "%s %s %s %s\n",$1,$2,$5,$6}' |while read comp user access typedoReport -view CompView -w "id in (select childId from CompMemberView where parentCompName = '$comp')" -raw |awk -F"|" '{ if ($1 == "'$comp'") if (("'$type'" == "restricted") && ("'$user'" != "InheritedAccess")) printf "%-20.20s %-15s %s\n",$1,"'$access'","Explicit Access Restricted" >> "'$ACCESS'" else if (("'$type'" == "restricted") && ("'$user'" == "InheritedAccess")) printf "%-20.20s %-15s %s\n",$1,"'$access'","Inherited Access Restricted" >> "'$ACCESS'" else if ("'$type'" == "granted") printf "%-20.20s %-15s %s\n",$1,"'$access'","Explicit Access Granted" >> "'$ACCESS'"}'doneif [ -s $ACCESS ]then cat $ACCESS | sort +0 -1else echo "No access for this user\n"fiechocleanupexit 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?