changeset 67:9d0fefce6985 default tip

remove rest_group_control
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 Nov 2024 21:21:53 -0700
parents 3fbe9cb2e325
children
files src/nabble/view/naml/compile_all.naml src/nabble/view/naml/edit_profile.naml src/nabble/view/naml/rest_group_control.naml src/nabble/view/web/template/NabbleNamespace.java
diffstat 4 files changed, 1 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
diff -r 3fbe9cb2e325 -r 9d0fefce6985 src/nabble/view/naml/compile_all.naml
--- a/src/nabble/view/naml/compile_all.naml	Wed Sep 18 03:51:47 2024 -0600
+++ b/src/nabble/view/naml/compile_all.naml	Wed Nov 06 21:21:53 2024 -0700
@@ -184,9 +184,6 @@
 	<n.compile macro="atom_topics_by_date" namespaces="[n.standard_classes/]" />
 	<n.compile macro="atom_posts_by_date" namespaces="[n.standard_classes/]" />
 
-	<n.comment.> REST </n.comment.>
-	<n.compile macro="rest_group_control" namespaces="[n.standard_classes/]" />
-
 	<n.compile macro="view_blog" namespaces="[n.standard_classes/]" />
 	<n.compile macro="view_board" namespaces="[n.standard_classes/]" />
 	<n.compile macro="view_category" namespaces="[n.standard_classes/]" />
diff -r 3fbe9cb2e325 -r 9d0fefce6985 src/nabble/view/naml/edit_profile.naml
--- a/src/nabble/view/naml/edit_profile.naml	Wed Sep 18 03:51:47 2024 -0600
+++ b/src/nabble/view/naml/edit_profile.naml	Wed Nov 06 21:21:53 2024 -0700
@@ -2,7 +2,7 @@
 	<n.my_user_page.>
 		<n.if.not.visitor.is_registered>
 			<then>
-				<n.login.><t>You must login to view this spage.</t></n.login.>
+				<n.login.><t>You must login to view this page.</t></n.login.>
 			</then>
 		</n.if.not.visitor.is_registered>
 
diff -r 3fbe9cb2e325 -r 9d0fefce6985 src/nabble/view/naml/rest_group_control.naml
--- a/src/nabble/view/naml/rest_group_control.naml	Wed Sep 18 03:51:47 2024 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-<!--
-Add/Remove users to/from groups.
-http://<site-domain>/template/NamlServlet.jtp?macro=rest_group_control&owner=owner@example.com&password=123456&user=user@example.com&action=add&group=Members
-http://<site-domain>/template/NamlServlet.jtp?macro=rest_group_control&owner=owner@example.com&password=123456&user=user@example.com&action=remove&group=Members
-Sample URLs
--->
-<macro name="rest_group_control" requires="servlet">
-	<n.check_not_null value="[n.rest_owner_email/]" error_msg="Invalid owner email."/>
-	<n.check_not_null value="[n.rest_owner_password_hash/]" error_msg="Invalid password hash."/>
-	<n.check_not_null value="[n.rest_user_email/]" error_msg="Invalid user email."/>
-	<n.check_not_null value="[n.rest_action/]" error_msg="Missing action."/>
-	<n.check_not_null value="[n.rest_group/]" error_msg="Missing group name."/>
-
-	<n.catch_exception. id="save-block">
-		<n.if.check_registered_user email="[n.rest_owner_email/]" password_hash="[n.rest_owner_password_hash/]">
-			<then>
-				<n.if.regex_matches text="[n.rest_action/]" pattern="add|remove">
-					<then>
-						<n.get_or_create_user. email="[n.rest_owner_email/]">
-							<n.as_user_page.>
-								<n.edit_page_user.>
-									<n.if.equal value1="[n.rest_action/]" value2="add">
-										<then><n.add_to_group.rest_group/></then>
-										<else><n.remove_from_group.rest_group/></else>
-									</n.if.equal>
-								</n.edit_page_user.>
-								Success.
-							</n.as_user_page.>
-						</n.get_or_create_user.>
-					</then>
-					<else>
-						Actions should be "add" or "remove".
-					</else>
-				</n.if.regex_matches>
-			</then>
-			<else>Invalid owner email and password.</else>
-		</n.if.check_registered_user>
-	</n.catch_exception.>
-</macro>
-
-<macro name="check_not_null" parameters="value,error_msg">
-	<n.if.is_null.value>
-		<then>
-			<n.error_msg/>
-			<n.exit/>
-		</then>
-	</n.if.is_null.value>
-</macro>
-
-<macro name="rest_owner_email">
-	<n.get_parameter name="owner"/>
-</macro>
-
-<macro name="rest_owner_password_hash">
-	<n.get_parameter name="password"/>
-</macro>
-
-<macro name="rest_action">
-	<n.get_parameter name="action"/>
-</macro>
-
-<macro name="rest_group">
-	<n.get_parameter name="group"/>
-</macro>
-
-<macro name="rest_user_email">
-	<n.get_parameter name="user"/>
-</macro>
\ No newline at end of file
diff -r 3fbe9cb2e325 -r 9d0fefce6985 src/nabble/view/web/template/NabbleNamespace.java
--- a/src/nabble/view/web/template/NabbleNamespace.java	Wed Sep 18 03:51:47 2024 -0600
+++ b/src/nabble/view/web/template/NabbleNamespace.java	Wed Nov 06 21:21:53 2024 -0700
@@ -809,18 +809,6 @@
 		}
 	}
 
-	public static final CommandSpec check_registered_user = new CommandSpec.Builder()
-		.parameters("email","password_hash")
-		.build()
-	;
-
-	@Command public void check_registered_user(IPrintWriter out,Interpreter interp) {
-		String email = interp.getArgString("email");
-		String pwd = interp.getArgString("password_hash");
-		User user = site.getUserFromEmail(email);
-		out.print( user != null && user.isRegistered() && user.checkPasscookie(pwd) );
-	}
-
 	public static final CommandSpec get_or_create_user = CommandSpec.DO()
 		.parameters("email")
 		.build()