Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsInSecurityRole Filter only works with Group Type Security Role #5326

Closed
1 task done
mikedotmundy opened this issue Feb 23, 2023 · 0 comments
Closed
1 task done

IsInSecurityRole Filter only works with Group Type Security Role #5326

mikedotmundy opened this issue Feb 23, 2023 · 0 comments

Comments

@mikedotmundy
Copy link

mikedotmundy commented Feb 23, 2023

Please go through all the tasks below

  • Check this box only after you have successfully completed both the above tasks

Please provide a brief description of the problem. Please do not forget to attach the relevant screenshots from your side.

The new IsInSecurityRole Filter that was added in v14 does not work properly if the Security Role is not a Group Type Security Role. For example, there are instances where I have created Groups and assigned them as Security Roles. So their Group Type may be Serving Team, Small Group, etc.

When using the Filter on a Group (Security Role) other than Group Type Security Role, the Filter returns false and logs an exception (as per the documentation, the exception is intentional and functioning properly).

If the desired intent is that this filter only works for Groups (Security Roles) of a Group Type Security Role, then we can just close this issue. I would also recommend the documentation be updated to specify this intent. As it currently reads, one would think any Security Role would work with this filter.

Screenshot 2023-02-22 at 21 36 22

Expected Behavior

I would expect all Security Roles to work with this filter.

Actual Behavior

Security Roles that are not Group Type Security Role do not work and log an exception.

Steps to Reproduce

  • While logged in as Alisha Admin, go to any group and add Alisha as a Group Member.

Screenshot 2023-02-22 at 21 33 23

  • Edit this group, expand the General section, and select Security Role. Save the Group.

Screenshot 2023-02-22 at 21 40 42

  • In any HTML Block, add the following code (update the Id to the Id of your Group from the previous step):
{% assign isInRole = CurrentPerson | IsInSecurityRole: 112 %}
{% if isInRole == true %}
  <p>{{ CurrentPerson.FullName }} is in that Role.</p>
{% else %}
  <p>{{ CurrentPerson.FullName }} is not in that Role.</p>
{% endif %}
  • Save, and see the filter returned false when it should have returned true.
  • Go to the exception log and see an exception is logged.

Screenshot 2023-02-22 at 21 35 49

Rock Version

v14.0, v14.1

Client Culture Setting

en-US

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants