ユーザーの権限の取得

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
	<xp:table>
		<xp:tr>
			<xp:td>
				<xp:button id="button1"
					value="アクセス権取得(getCurrentAccessLevel())">
					<xp:eventHandler event="onclick" submit="true"
						refreshMode="complete" id="eventHandler1">
						<xp:this.action><![CDATA[#{javascript:var msg = "";
switch (database.getCurrentAccessLevel()) {
    case NotesACL.LEVEL_MANAGER		:	label = "管理者";
    case NotesACL.LEVEL_DESIGNER	:	label = "設計者";
    case NotesACL.LEVEL_EDITOR		:	label = "編集者";
    case NotesACL.LEVEL_AUTHOR		:	label = "作成者";
    case NotesACL.LEVEL_READER		:	label = "読者";
    case NotesACL.LEVEL_DEPOSITOR	:	label = "投稿者"
    ;
}
msg = "あなたの権限は" + label + "です";
requestScope.put("ACL", msg);

}]]></xp:this.action>
					</xp:eventHandler>
				</xp:button>
			</xp:td>
			<xp:td>
				<xp:label id="label1">
					<xp:this.value><![CDATA[#{javascript:requestScope.get("ACL");}]]></xp:this.value>
				</xp:label>
			</xp:td>
		</xp:tr>
		<xp:tr>
			<xp:td>
				<xp:button id="button2"
					value="特権取得(queryAccessPrivileges())">
					<xp:eventHandler event="onclick" submit="true"
						refreshMode="complete" id="eventHandler2">
						<xp:this.action><![CDATA[#{javascript:var user:string = session.getUserName();
var accPriv:int = database.queryAccessPrivileges(user);
var msg = "";
if ((accPriv & NotesDatabase.DBACL_CREATE_DOCS) > 0){
	 msg += "文書の作成\n";
}
if ((accPriv & NotesDatabase.DBACL_DELETE_DOCS) > 0){
	msg += "文書の削除\n";
}
if ((accPriv & NotesDatabase.DBACL_CREATE_PRIV_AGENTS) > 0){
	msg += "個人エージェントの作成 \n";
}
if ((accPriv & NotesDatabase.DBACL_CREATE_PRIV_FOLDERS_VIEWS) > 0){
	msg += "個人フォルダ/ビューの作成\n";
}
if ((accPriv & NotesDatabase.DBACL_CREATE_SHARED_FOLDERS_VIEWS) > 0){
	msg += "共有フォルダ/ビューの作成\n";
}
if ((accPriv & NotesDatabase.DBACL_CREATE_SCRIPT_AGENTS) > 0){
	msg += "LotusScript/Java エージェントの作成\n";
}
if ((accPriv & NotesDatabase.DBACL_READ_PUBLIC_DOCS) > 0){
	msg += "パブリック文書[読者]\n";
}
if ((accPriv & NotesDatabase.DBACL_WRITE_PUBLIC_DOCS) > 0){
	msg += "パブリック文書[作成者]\n";
}
if ((accPriv & NotesDatabase.DBACL_REPLICATE_COPY_DOCS) > 0){
	msg += "文書を複製またはコピー\n";
}
requestScope.put("status", msg)}]]></xp:this.action>
					</xp:eventHandler>
				</xp:button>
			</xp:td>
			<xp:td>
				<xp:inputTextarea id="inputTextarea1">
					<xp:this.value><![CDATA[#{javascript:requestScope.get("status");}]]></xp:this.value>
				</xp:inputTextarea>
			</xp:td>
		</xp:tr>
	</xp:table>
	<xp:br></xp:br>
	<xp:br></xp:br>
	<xp:br></xp:br>
	</xp:view>





現在のユーザーのデータベースへのアクセスレベルとデータベース内での特権を返します。


XPages
eri
August 28, 2018 at 2:18 PM
Rating
0





No comments yetLogin first to comment...