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