When i try to upload my documents through the ODK app it worked well, but after few changes to the code i got this error Employee Registration - Errorr: Internal Server Error (500) http://......./submission?deviceID=imei%........ So please help me since i am just a beginner
Code :
vi md5.sh
#!/bin/bash
echo -n $1 | md5sum | awk '{print $1}'
chmod 555 md5.sh
./md5.sh "fb:odk ODK Aggregate:happy"
digest_auth=`echo -n $username:$realm:$passwd |md5sum |awk '{print $1}'`
newuser()
,
_user_granted_authority
_registered_users
CREATE OR REPLACE FUNCTION create_ID(un text,pass text,role_allocate text) RETURNS void AS $$
DECLARE
BEGIN
INSERT INTO
rh._registered_users_test("_URI","_CREATOR_URI_USER","_CREATION_DATE","_LAST_UPDATE_URI_USER","_LAST_UPDATE_DATE","LOCAL_USERNAME","DIGEST_AUTH_PASSWORD","IS_REMOVED")
VALUES
(concat('uid:',un,'|',now()),'uid:admin|2015-12-22T14:22:47.437+0000',now(),'uid:admin|2015-12-22T14:22:47.437+0000',now(),un,md5(concat(un,':odk ODK Aggregate:',pass)),'f');
INSERT INTO
rh._user_granted_authority_test("_URI","_CREATOR_URI_USER","_CREATION_DATE","_LAST_UPDATE_URI_USER","_LAST_UPDATE_DATE","USER","GRANTED_AUTHORITY")
VALUES
(concat('uid:',un,'|',now()),'uid:admin|2015-12-22T14:22:47.437+0000',now(),'uid:admin|2015-12-22T14:22:47.437+0000',now(),un,role_allocate);
END;
$$ language plpgsql;
DO $$ BEGIN
PERFORM create_ID('fb','happy','GROUP_DATA_COLLECTORS');
END $$;
=========================================================
CREATE OR REPLACE FUNCTION _fb_create_ID() RETURNS trigger AS $$
DECLARE
BEGIN
INSERT INTO
rh._registered_users_test("_URI","_CREATOR_URI_USER","_CREATION_DATE","_LAST_UPDATE_URI_USER","_LAST_UPDATE_DATE","LOCAL_USERNAME","DIGEST_AUTH_PASSWORD","IS_REMOVED")
VALUES
(concat('uid:',NEW.EID,'|',now()),'uid:admin|2015-12-22T14:22:47.437+0000',now(),'uid:admin|2015-12-22T14:22:47.437+0000',now(),NEW.EID,md5(concat(NEW.EID,':odk ODK Aggregate:',NEW.EID)),'f');
INSERT INTO
rh._user_granted_authority_test("_URI","_CREATOR_URI_USER","_CREATION_DATE","_LAST_UPDATE_URI_USER","_LAST_UPDATE_DATE","USER","GRANTED_AUTHORITY")
VALUES
(concat('uid:',NEW.EID,'|',now()),'uid:admin|2015-12-22T14:22:47.437+0000',now(),'uid:admin|2015-12-22T14:22:47.437+0000',now(),NEW.EID,'GROUP_DATA_COLLECTORS');
RETURN new;
END;
$$ language plpgsql;
CREATE TRIGGER __fb_er_upload_master_trig
AFTER INSERT ON rehash7."_fb_uploaded_registrations"
FOR EACH ROW
EXECUTE PROCEDURE _fb_create_ID();
select * from _registered_users_test;
select * rehash7._user_granted_authority_test;