本文整理匯總了Java中org.apache.jackrabbit.core.security.principal.PrincipalImpl類的典型用法代碼示例。如果您正苦於以下問題:Java PrincipalImpl類的具體用法?Java PrincipalImpl怎麽用?Java PrincipalImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PrincipalImpl類屬於org.apache.jackrabbit.core.security.principal包,在下文中一共展示了PrincipalImpl類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createUser
import org.apache.jackrabbit.core.security.principal.PrincipalImpl; //導入依賴的package包/類
public boolean createUser(String name, String pass) throws AuthorizableExistsException, RepositoryException {
// usual entry point into the Jackrabbit API
JackrabbitSession js = (JackrabbitSession) session;
UserManager um = js.getUserManager();
PrincipalImpl p = new PrincipalImpl(name);
String usersPath = "/" + name;
User u = um.createUser(name, pass, p, null);
u.setProperty("homeFolder", session.getValueFactory().createValue(usersPath));
// "HOME" folder for the brand new user
// createUsersFolder(name, session);
// Assign permissions to the "HOME" folder of the just created user
// assignInitialPermissions(u, u.getPrincipal(), usersPath, session);
session.save();
return true;
}