Adding Roles to Authenticated users

13 views
Skip to first unread message

Muhammad Saleh

unread,
Dec 19, 2020, 2:16:52 PM12/19/20
to Sahana-Eden
Hey guys I tried adding an additional roles to an authenticated user but it is giving me error "invalid request options", and i can only disable users not  delete them. Can anyone pls put me through

Dominic König

unread,
Dec 19, 2020, 4:10:33 PM12/19/20
to sahan...@googlegroups.com
Hi--

lördag 19 december 2020 kl. 20:16:52 CET skrev Muhammad Saleh:
> Hey guys I tried adding an additional roles to an authenticated user but it
> is giving me error "invalid request options"

This is impossible to answer without more in-depth information about which
role you were trying to add, and how you attempted to do that, which code
version you are using etc.

I've been adding/removing user roles many times in recent days, and never seen
that error - and it is difficult to see from the code how that would at all be
possible, as it would mean that the JSON library of your browser produces
invalid JSON, which is somewhat inconceivable.

So I'm afraid you need to help us here to reproduce the error before we can
tell what causes it, and perhaps fix it.

> , and i can only disable users
> not delete them.

That is correct - you cannot delete users because they are almost always
referenced as owners and/or authors/editors of other records, so you can only
ever disable them...which is a deliberate design choice, though, i.e. it's an
integrity feature, not a bug.

However, after disabling them, you can anonymize their accounts in order to
remove their data - if your template provides an anonymizer configuration.

An example configuration of the anonymizer that includes user accounts can be
found here:
https://github.com/sahana/eden/blob/master/modules/templates/RLP/anonymize.py

Most standard templates will not have that, though - so you will probably have
to make do with just disabling the account.

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 19, 2020, 5:17:32 PM12/19/20
to sahan...@googlegroups.com
thanks for getting back to me so quickly im talking about assigning user roles to a user through administrator menu

--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sahana-eden/2046545.irdbgypaU6%40aldebaran.

Dominic König

unread,
Dec 19, 2020, 5:42:34 PM12/19/20
to sahan...@googlegroups.com
lördag 19 december 2020 kl. 23:17:18 CET skrev Muhammad Saleh:
> thanks for getting back to me so quickly im talking about assigning user
> roles to a user through administrator menu

Yes, I understood that - if you could just elaborate a little?

- which version of the code
- which browser (+version)
- which Eden template are you running?
- did you modify any code?
- which role are you trying to assign?
- which exact page (maybe a screenshot?)
- where do you see the error (maybe a screenshot?)
- which exact steps can we take to reproduce the error, starting from creating
the user and the role and then assign?
- could you perhaps open a debug console in the browser and check the Ajax
request that produces the error (what data were sent to the server?)

Meaning: it is necessary for a developer to debug this, and in order to do
that, we need to reproduce the error on one of our machines - but from what
you told us so far, we don't see that error on our machines.

So obviously, we're doing something differently, and it is impossible to see
what that could be unless you give us more details.

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 21, 2020, 5:36:49 AM12/21/20
to sahan...@googlegroups.com
Hi Good day
Im using jquery-2.2.4, Firefox 84.0 64-bit,
i'm using Default Template
most of the code i modify is related to template,


--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.
Screenshot_2020-12-21 Roles of User rukkywala gmail com.png

Dominic König

unread,
Dec 21, 2020, 5:49:13 AM12/21/20
to sahan...@googlegroups.com
Hi--

måndag 21 december 2020 kl. 11:36:39 CET skrev Muhammad Saleh:
> Hi Good day
> Im using jquery-2.2.4, Firefox 84.0 64-bit,
> i'm using Default Template
> most of the code i modify is related to template,

I'm afraid this is still not enough information for us to reproduce the error,
or at least I'm still unable to reproduce it.

Could you perhaps share your code modifications (on GitHub?), and also tell us
which security policy you're using?

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 22, 2020, 4:24:00 AM12/22/20
to sahan...@googlegroups.com
hi dominic thanks a lot but the problem is I'm new to Sahana Eden and python in general, i became interested when i read about what sahana can do, i thought i can be able to use it to manage the humanitarian crisis bedeviling our state. im still in the process of understanding the sahana, i hosted it on pythonanywhere i think i will provide you with the admin login details to see what im talking about, if it's ok with you.

--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.

Dominic König

unread,
Dec 22, 2020, 6:47:11 AM12/22/20
to sahan...@googlegroups.com
tisdag 22 december 2020 kl. 10:23:46 CET skrev Muhammad Saleh:
> hi dominic thanks a lot but the problem is I'm new to Sahana Eden and
> python in general, i became interested when i read about what sahana can
> do, i thought i can be able to use it to manage the humanitarian crisis
> bedeviling our state. im still in the process of understanding the sahana,
> i hosted it on pythonanywhere i think i will provide you with the admin
> login details to see what im talking about, if it's ok with you.

Yes, maybe that could be a first step - but eventually, I think, I will have
to take a look at your configuration and code changes.

If you do send credentials, please send them off-list (directly to me). I
assume we're talking about a trial/demo installation without any sensitive
production data?

Dominic
signature.asc

Dominic König

unread,
Dec 22, 2020, 4:32:26 PM12/22/20
to sahan...@googlegroups.com
Hi--

I've looked at your site, and found two general compatibility problems:

1) you are running Python-3.5.9, but Sahana Eden requires Python-3.6+

2) you are running web2py-2.18.5-stable, but the Eden version you have
requires web2py-2.20.4 or later

The former is (almost certainly) the cause of the error - the request body is
represented as a byte stream (BytesIO), but the json parser in Python-3.5 only
works with decoded text, so the parsing of the request to assign or remove a
role would fail - which in turn explains the error you see.

This is one of many quirks of Python versions between 2.7 and 3.6, which is
why we don't support them - apart from the fact that those Python versions are
themselves no longer supported. So, the solution is to upgrade to a supported
Python version.

...and to a supported web2py version, of course: web2py-2.20.4-stable is the
version supported by Eden-stable and the Eden-trunk version you're currently
running (while latest Eden-trunk also supports web2py-2.21.1).

Dominic
> --
> You received this message because you are subscribed to the Google Groups
> "Sahana-Eden" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to sahana-eden...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sahana-eden/5668155.lOV4Wx5bFT%40aldebara
> n.

signature.asc

Muhammad Saleh

unread,
Dec 23, 2020, 4:59:28 AM12/23/20
to sahan...@googlegroups.com
thanks a lot Sir. i really appreciate it. You are very correct. I have rectified the problem. Another issue i am having is installing ReportLap and making it work. I will be contacting you from time to time if I have any questions.

Dominic König

unread,
Dec 23, 2020, 5:04:53 AM12/23/20
to sahan...@googlegroups.com
onsdag 23 december 2020 kl. 10:59:14 CET skrev Muhammad Saleh:
> Another issue i am having is installing ReportLap
> and making it work

"pip install reportlab" ...should do it, no?

If it does not, then what's the error it reports?

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 23, 2020, 6:25:41 AM12/23/20
to sahan...@googlegroups.com
Hi mr Dominic can you pls check the portal ive upgraded the python and the web2py but when i click on staff summary is giving me an error "

<class 'AttributeError'> 'DAL' object has no attribute 'pr_email_contact'


--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.

Dominic König

unread,
Dec 23, 2020, 6:37:24 AM12/23/20
to sahan...@googlegroups.com
onsdag 23 december 2020 kl. 12:25:27 CET skrev Muhammad Saleh:
> Hi mr Dominic can you pls check the portal ive upgraded the python and the
> web2py but when i click on staff summary is giving me an error " <class
> 'AttributeError'> 'DAL' object has no attribute 'pr_email_contact'

Hi--

yes, now you have upgraded web2py to 2.21.1-stable, which is supported by the
latest Eden, but not by the Eden version you're running.

You have two options now: Either you upgrade Eden to the latest trunk, or you
downgrade web2py to 2.20.4-stable.

Better of course to upgrade Eden, but I understand if you don't want to do
that because it could conflict with your code changes.

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 23, 2020, 6:47:41 AM12/23/20
to sahan...@googlegroups.com
thanks but how can i downgrade the web2py in pythonanywhere

--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.

Dominic König

unread,
Dec 23, 2020, 7:01:59 AM12/23/20
to sahan...@googlegroups.com
onsdag 23 december 2020 kl. 12:47:27 CET skrev Muhammad Saleh:
> thanks but how can i downgrade the web2py in pythonanywhere

Hmm, honestly - I don't know.

I assume you upgraded it through the web2py-Admin UI, but that of course has
no obvious way of downgrading.

In regular installs, we git-clone web2py, so then downgrading would be simply
to reset to the target commit, and then update all submodules:

cd /home/web2py
git pull
git reset --hard 777c305
git submodule update --recursive

...but to do that, you would need SSH-access to the server backend.

Maybe you can upgrade your Eden after all?

Dominic
signature.asc

Muhammad Saleh

unread,
Dec 23, 2020, 7:07:08 AM12/23/20
to sahan...@googlegroups.com
ok thanks then the best way is upgrading the Eden. how can i do that?

--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.

Dominic König

unread,
Dec 23, 2020, 7:27:00 AM12/23/20
to sahan...@googlegroups.com
onsdag 23 december 2020 kl. 13:06:54 CET skrev Muhammad Saleh:
> ok thanks then the best way is upgrading the Eden. how can i do that?

That depends on how you deployed it in the first place.

If you copied your Eden folder from a local git clone, you will have to do a
"git pull" locally, and then re-upload your Eden folder.

If you cloned directly in the Bash-Editor, you would have to "git pull" there.

Either way, this pull may lead to conflicts with the changes you made, which
you may then have to resolve manually.

Note that PythonAnywhere is a somewhat unusual way of deploying Eden, and we
don't have much experience with it (or in my case, none at all). I can try,
within my limited understanding of the platform - but maybe someone else here
can help you better?

Dominic
signature.asc
Reply all
Reply to author
Forward
0 new messages