svn:ignore, missing files

git-svn-id: https://svn.libreccm.org/ccm/trunk@5893 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-03-30 10:06:22 +00:00
parent 6ebf29793f
commit c6a23df369
2 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,42 @@
package com.arsdigita.cms;
import com.arsdigita.util.cmd.Program;
import java.io.PrintWriter;
import org.apache.commons.cli.CommandLine;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class FolderRetrieveTest extends Program {
public FolderRetrieveTest() {
super("FolderRetrieveTest", "1.0.0", "");
}
public static final void main(final String[] args) {
new FolderRetrieveTest().run(args);
}
public void doRun(final CommandLine cmdLine) {
final PrintWriter writer = new PrintWriter(System.out);
final ContentSectionCollection sections = ContentSection.getAllSections();
sections.addEqualsFilter("label", "content");
sections.next();
final ContentSection section = sections.getContentSection();
final Folder folder = Folder.retrieveFolder(section, "/personen");
if (folder == null) {
writer.println("Failed to get folder.");
} else {
writer.printf("Got folder '%s'\n", folder.getPath());
}
writer.flush();
}
}

View File

@ -0,0 +1,54 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.util.cmd;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.UserCollection;
import org.apache.commons.cli.CommandLine;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
*/
public class SetNewPassword extends Program{
public SetNewPassword() {
super("SetNewPasswort", "1.0.0", "SetNewPassword screenname newpassword");
}
@Override
protected void doRun(CommandLine cmdLine) {
final String[] args = cmdLine.getArgs();
if (args.length != 2) {
System.out.println("Usage: SetNewPassword screenname newpassword");
return;
}
final UserCollection users = User.retrieveAll();
users.addEqualsFilter("screenName", args[0]);
if (users.isEmpty()) {
System.out.printf("User '%s' not found.\n", args[0]);
return;
}
users.next();
final User user = users.getUser();
users.close();
final UserAuthentication auth = UserAuthentication.retrieveForUser(user);
auth.setPassword(args[1]);
auth.save();
System.out.println("Set new password");
}
public static void main(final String[] args) {
new SetNewPassword().run(args);
}
}