aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU-AD\carlsoan <carlsoan@gophersjos7275.ad.uc.edu>2018-06-28 12:06:22 -0400
committerU-AD\carlsoan <carlsoan@gophersjos7275.ad.uc.edu>2018-06-28 12:06:22 -0400
commit9063bd57fd590a435ce6e485c0a4145ea621f431 (patch)
tree8752f5b930e7731527de1e3413463a624c5058a0
parent8512370cc8f727fa65fe930a3471a148fae37034 (diff)
modified UI and readme
-rw-r--r--Makefile67
-rw-r--r--README.md19
-rw-r--r--useredit.html7
3 files changed, 67 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index ad52669..7171ff6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,53 @@
-all: tmp/userlist.txt
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -X MKCOL $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/apps/users > /dev/null
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -X MKCOL $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/apps/users/edit > /dev/null
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -X MKCOL $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/apps/users/manage > /dev/null
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -X MKCOL $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/content/newuser > /dev/null
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -T useredit.html $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/apps/users/edit/html.esp > /dev/null
- curl -s -u $$(grep '^USER' tmp/server.txt | sed 's/^USER //g'):$$(grep '^PASS' tmp/server.txt | sed 's/^PASS //g') -T usermgr.html $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/apps/users/manage/html.esp > /dev/null
- cat tmp/userlist.txt | xargs -L1 -ITHISUSER bash -c 'THISUSR="THSIUSER" ; curl -s -u $$(grep "^USER" tmp/server.txt | sed "s|^USER ||g"):$$(grep "^PASS" tmp/server.txt | sed "s|^PASS ||g") -F"sling:resourceType=users/edit" $$(grep "^PROTO" tmp/server.txt | sed "s|^PROTO ||g")://$$(grep "^HOST" tmp/server.txt | sed "s|^HOST ||g")/home/users/$${THISUSR:0:1}/$$THISUSR.html > /dev/null'
- cat tmp/userlist.txt | xargs -L1 -ITHISUSER bash -c 'THISUSR="THISUSER" ; curl -s -u $$(grep "^USER" tmp/server.txt | sed "s|^USER ||g"):$$(grep "^PASS" tmp/server.txt | sed "s|^PASS ||g") -F"uid=$$THISUSER" $$(grep "^PROTO" tmp/server.txt | sed "s|^PROTO ||g")://$$(grep "^HOST" tmp/server.txt | sed "s|^HOST ||g")/home/users/$${THISUSR:0:1}/$$THISUSR.html > /dev/null'
+define newsetting
+@read -p "$(1) [$(3)]: " thisset ; [[ -z "$$thisset" ]] && echo "$(2) $(3)" >> $(4) || echo "$(2) $$thisset" | sed 's/\/$$//g' >> $(4)
+endef
-clean:
- rm -rf tmp
+define getsetting
+$$(grep "^$(2)[ \t]*" $(1) | sed 's/^$(2)[ \t]*//g')
+endef
-tmp/server.txt: tmp
- @echo "PROTO $$(read -p "Enter protocol [http]: " proto ; [[ -z "$$proto" ]] && echo "http" || echo "$$proto" )" > tmp/server.txt
- @echo "HOST $$(read -p "Enter host and port [localhost:8080]: " hostport ; [[ -z "$$hostport" ]] && echo "localhost:8080" || echo "$$hostport" )" >> tmp/server.txt
- @echo "USER $$(read -p "Enter sling username [admin]: " slinguser ; [[ -z "$$slinguser" ]] && echo "admin" || echo "$$slinguser" )" >> tmp/server.txt
- @echo "PASS $$(read -p "Enter sling password [admin]: " slingpass ; [[ -z "$$slingpass" ]] && echo "admin" || echo "$$slingpass" )" >> tmp/server.txt
+define confuser
+while read THISUSER; do curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -F"sling:resourceType=users/edit" $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/home/users/$${THISUSER:0:1}/$$THISUSER.html > /dev/null; curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -F"uid=$$THISUSER" $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/home/users/$${THISUSER:0:1}/$$THISUSER.html > /dev/null; done
+endef
+
+all:
+ @echo "Build procedure:"
+ @echo "1. conf -> configure server settings"
+ @echo "2. server -> push server settings"
+ @echo "3. protect -> add access control for user management pages"
+ @echo " NOTE: Step 3 will recreate configuration for \"Apache Sling Authentication Service\""
+ @echo " Backup current settings if necessary"
+
+
+server:
+ [[ -f tmp/server.txt ]] || exit
+ [[ -f tmp/userlist.txt ]] || exit
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -X MKCOL $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/apps/users > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -X MKCOL $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/apps/users/edit > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -X MKCOL $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/apps/users/manage > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -X MKCOL $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/content > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -X MKCOL $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/content/usermgr > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -T useredit.html $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/apps/users/edit/html.esp > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -T usermgr.html $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/apps/users/manage/html.esp > /dev/null
+ curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -F"sling:resourceType=users/manage" $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/content/usermgr.html > /dev/null
+ $(call confuser) < tmp/userlist.txt
+
+protect:
+ echo "apply=true&action=ajaxConfigManager&%24location=launchpad%3Aresources%2Finstall%2F0%2Forg.apache.sling.auth.core-1.3.10.jar&auth.sudo.cookie=sling.sudo&auth.sudo.parameter=sudo&auth.annonymous=true&auth.annonymous=false&sling.auth.requirements=%2Fcontent%2Fusermgr.html&sling.auth.requirements=%2Fhome%2Fusers&sling.auth.anonymous.user=&sling.auth.anonymous.password=unmodified&auth.http=preemptive&auth.http.realm=Sling+(Development)&auth.uri.suffix=%2Fj_security_check&propertylist=auth.sudo.cookie%2Cauth.sudo.parameter%2Cauth.annonymous%2Csling.auth.requirements%2Csling.auth.anonymous.user%2Csling.auth.anonymous.password%2Cauth.http%2Cauth.http.realm%2Cauth.uri.suffix" | curl -s -u $(call getsetting,tmp/server.txt,USER):$(call getsetting,tmp/server.txt,PASS) -d @- $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator
-tmp/userlist.txt: tmp tmp/server.txt
- curl -s $$(grep '^PROTO' tmp/server.txt | sed 's/^PROTO //g')://$$(grep '^HOST' tmp/server.txt | sed 's/^HOST //g')/system/userManager/user.1.json | sed 's/}$$/\n}/;s/^{/{\n/g;s/},/},\n/g' | awk 'BEGIN { FS=":" } { print $$1 }' | egrep -v '{|}' | sed 's/"//g' | grep -v anonymous > tmp/userlist.txt
+conf: tmp/userlist.txt
+
+tmp/userlist.txt: tmp/server.txt
+ curl -s $(call getsetting,tmp/server.txt,PROTO)://$(call getsetting,tmp/server.txt,HOST)/system/userManager/user.1.json | sed 's/}$$/\n}/;s/^{/{\n/g;s/},/},\n/g' | awk 'BEGIN { FS=":" } /^"/ { username=gensub(/"/,"","g",$$1); if (username !~ /^anonymous$$/) { print username; } }' > tmp/userlist.txt
+
+tmp/server.txt: tmp
+ $(call newsetting,Enter Protocol,PROTO,http,tmp/server.txt)
+ $(call newsetting,Enter host and port,HOST,localhost:8080,tmp/server.txt)
+ $(call newsetting,Enter Username,USER,admin,tmp/server.txt)
+ $(call newsetting,Enter Password,PASS,admin,tmp/server.txt)
tmp:
- mkdir tmp
+ mkdir -p tmp
+
+clean:
+ rm -rf tmp
diff --git a/README.md b/README.md
index 133e3d1..8748933 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,14 @@
# sling-usermgr
-### Installing
-1. Clone repository
-2. ```make```
-3. Enter preferences as prompted
-
+### Config and Install
+1. Run ```make config``` to set server preferences
+2. Run ```make server``` to push configuration and templates to the server
+3. Run ```make protect``` to reconfigure the "Apache Sling Authentication Service". This will require authentication for all of the pages of this application. (*)
+
+(*) Note that running ```make protect``` will remove all existing configuration for "Apache Sling Authentication Service". Backing up configuration might be necessary.
+
### Using
-1. Navigate to http://HOST:PORT/system/console and login at admin
-2. Once logged in, navigate to http://HOST:PORT/usermgr.html
+Navigate to http://HOST:PORT/content/usermgr.html and login at admin.
+
+From here you can create new users or click on a user to modify.
+
+If you choose to edit a user, you can reset the password or add properties to a user.
diff --git a/useredit.html b/useredit.html
index db5e401..f310d19 100644
--- a/useredit.html
+++ b/useredit.html
@@ -33,6 +33,13 @@ New Password:<input type="password" name="newPwd" /><br/>
Confirm New:<input type="password" name="newPwdConfirm" /><br/>
<input type="submit" value="Change Password" />
</form><br/>
+<h3>Add Property to <%= currentNode.uid %></h3>
+<form action="" method="POST">
+Attribute Name:<input id="propname" onChange="document.getElementById('newprop').name=this.value;" /><br/>
+Attribute Value:<input id="propval" onChange="document.getElementById('newprop').value=this.value;" /><br/>
+<input type="hidden" id="newprop" />
+<input type="submit" value="Create Property" />
+</form><br/>
<h3>User Information (JSON)</h3>
<pre id="userjson"></pre>
<br/><a href="/content/usermgr.html">Return to User Manager</a>