social-core icon indicating copy to clipboard operation
social-core copied to clipboard

Map is_staff, is_active and is_superuser into the user details

Open surfer190 opened this issue 5 years ago • 1 comments

Proposed changes

I want to allow attributes on the identity - to map to user attributes. Specifically the default protected keys is_staff, is_active and is_superuser.

Reasoning is that sometimes you want to be default give a user staff permissions. It is blocked by default anywhere with the protected attributes - so mapping those values in will be superfluous in many cases.

protected = ('username', 'id', 'pk', 'email', 'password',
                     'is_active', 'is_staff', 'is_superuser',)

I understand that this could be a custom pipeline - however these are specifically user attributes.

Types of changes

Please check the type of change your PR introduces:

  • [ ] Release (new release request)
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [X ] New feature (non-breaking change which adds functionality)
  • [ ] Code style update (PEP8, lint, formatting, renaming, etc)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Build related changes (build process, tests runner, etc)
  • [ ] Other (please describe):

Checklist

  • [ ] Lint and unit tests pass locally with my changes
  • [ ] I have added tests that prove my fix is effective or that my feature works

Other information

I am happy to add the unit tests but could @omab @aleksihakli please give some guidance...if you would rather this be solved with a custom pipeline by developers instead of adding it to the backend.

surfer190 avatar Mar 25 '21 10:03 surfer190

Codecov Report

Merging #578 (d726a39) into master (b401307) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #578   +/-   ##
=======================================
  Coverage   76.04%   76.04%           
=======================================
  Files         312      312           
  Lines        9436     9436           
  Branches      464      464           
=======================================
  Hits         7176     7176           
  Misses       2108     2108           
  Partials      152      152           
Flag Coverage Δ
unittests 76.04% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
social_core/backends/keycloak.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b401307...d726a39. Read the comment docs.

codecov[bot] avatar Mar 25 '21 10:03 codecov[bot]