0
嘗試開發一個宏,其中如果用戶提供密鑰,則應遵循以下流程: 1.驗證密鑰是否存在並顯示空間標題 2.獲取空間管理員。匯合宏:獲得空間管理員
了宏觀的從谷歌,能夠執行第二次,但第一個是棘手的檢查(新的宏觀和融合
## Macro title: Space Administrators
## Macro has a body: Y or N (N)
## Body processing: Selected body processing option
## Output: Selected output option
## usage: {getspacekey: spacekey1}
## Installed by: Piyush Annadate
## Macro to list all users and groups with the permission to administer the current space.
## @param 0:title=Space Key|type=string|required=true
#if ($param0)
## trim and test for illegal characters
#set ($spacekey1= $param0.trim())
#if ($spacekey1.matches("[a-zA-Z0-9]+"))
<h1>Space Adminstrators</h1>
<p>The following users and groups have permission to administer the <strong>$spacekey1</strong> Space.</p>
<h2>Users</h2>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Administrators</th>
</tr>
#foreach ($permission in $space.getPermissions())
#if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
<tr>
<td class="confluenceTd">#usernameLink($permission.getUserName())</td>
</tr>
#end
#end
</table>
<h2>Groups</h2>
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ($groupString = $permission.getGroup())
#set ($groupObject = $userAccessor.getGroup($groupString))
#set ($memberList = $userAccessor.getMemberNamesAsList($groupObject))
<h3>$groupString</h3>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">Space Administrators</th>
</tr>
#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end
#else
Space key {color:red} is invalid.Space key is not available or does not matched a-z, A-Z, 0-9 pattern. {color}
#end
#end
請簡而言之,你已經改變了什麼。 – ppasler