0001-misc-add-logo-and-text-color-for-service-and-OU.patch
src/authentic2/a2_rbac/migrations/0027_auto_20220329_1259.py | ||
---|---|---|
1 |
# Generated by Django 2.2.24 on 2022-03-10 10:59 |
|
2 | ||
3 |
from django.db import migrations, models |
|
4 | ||
5 | ||
6 |
class Migration(migrations.Migration): |
|
7 | ||
8 |
dependencies = [ |
|
9 |
('a2_rbac', '0026_add_roleparenting_soft_delete'), |
|
10 |
] |
|
11 | ||
12 |
operations = [ |
|
13 |
migrations.AddField( |
|
14 |
model_name='organizationalunit', |
|
15 |
name='logo', |
|
16 |
field=models.ImageField(blank=True, upload_to='services/logos', verbose_name='Logo'), |
|
17 |
), |
|
18 |
migrations.AddField( |
|
19 |
model_name='organizationalunit', |
|
20 |
name='text_color', |
|
21 |
field=models.CharField(blank=True, max_length=7, null=True, verbose_name='Colour'), |
|
22 |
), |
|
23 |
] |
src/authentic2/a2_rbac/models.py | ||
---|---|---|
113 | 113 |
default=760, # two years + 1 month |
114 | 114 |
) |
115 | 115 |
home_url = models.URLField(verbose_name=_('Home URL'), max_length=256, null=True, blank=True) |
116 |
logo = models.ImageField(verbose_name=_('Logo'), blank=True, upload_to='services/logos') |
|
117 |
text_color = models.CharField(verbose_name=_('Colour'), null=True, blank=True, max_length=7) |
|
116 | 118 | |
117 | 119 |
objects = managers.OrganizationalUnitManager() |
118 | 120 |
src/authentic2/manager/forms.py | ||
---|---|---|
633 | 633 |
def __init__(self, *args, **kwargs): |
634 | 634 |
super().__init__(*args, **kwargs) |
635 | 635 |
self.fields['name'].label = _('label').title() |
636 |
self.fields['text_color'].widget = forms.TextInput(attrs={'type': 'color'}) |
|
636 | 637 | |
637 | 638 |
class Meta: |
638 | 639 |
model = OrganizationalUnit |
... | ... | |
650 | 651 |
'clean_unused_accounts_alert', |
651 | 652 |
'clean_unused_accounts_deletion', |
652 | 653 |
'home_url', |
654 |
'logo', |
|
655 |
'text_color', |
|
653 | 656 |
) |
654 | 657 | |
655 | 658 |
src/authentic2/migrations/0037_auto_20220329_1512.py | ||
---|---|---|
1 |
# Generated by Django 2.2.24 on 2022-03-29 13:12 |
|
2 | ||
3 |
from django.db import migrations, models |
|
4 | ||
5 | ||
6 |
class Migration(migrations.Migration): |
|
7 | ||
8 |
dependencies = [ |
|
9 |
('authentic2', '0036_service_profile_types'), |
|
10 |
] |
|
11 | ||
12 |
operations = [ |
|
13 |
migrations.AddField( |
|
14 |
model_name='service', |
|
15 |
name='logo', |
|
16 |
field=models.ImageField(blank=True, upload_to='services/logos', verbose_name='Logo'), |
|
17 |
), |
|
18 |
migrations.AddField( |
|
19 |
model_name='service', |
|
20 |
name='text_color', |
|
21 |
field=models.CharField(blank=True, max_length=7, null=True, verbose_name='Colour'), |
|
22 |
), |
|
23 |
] |
src/authentic2/models.py | ||
---|---|---|
382 | 382 |
verbose_name=_('callback url when unauthorized'), max_length=256, null=True, blank=True |
383 | 383 |
) |
384 | 384 |
home_url = models.URLField(verbose_name=_('Home URL'), max_length=256, null=True, blank=True) |
385 |
logo = models.ImageField(verbose_name=_('Logo'), blank=True, upload_to='services/logos') |
|
386 |
text_color = models.CharField(verbose_name=_('Colour'), null=True, blank=True, max_length=7) |
|
385 | 387 | |
386 | 388 |
profile_types = models.ManyToManyField( |
387 | 389 |
to='custom_user.ProfileType', |
tests/idp_oidc/test_misc.py | ||
---|---|---|
79 | 79 |
'authorization_mode': OIDCClient.AUTHORIZATION_MODE_NONE, |
80 | 80 |
}, |
81 | 81 |
{ |
82 |
'idtoken_duration': datetime.timedelta(hours=1),
|
|
82 |
'idtoken_duration': '3600',
|
|
83 | 83 |
}, |
84 | 84 |
{ |
85 | 85 |
'authorization_flow': OIDCClient.FLOW_IMPLICIT, |
86 |
'idtoken_duration': datetime.timedelta(hours=1),
|
|
86 |
'idtoken_duration': '3600',
|
|
87 | 87 |
'post_logout_redirect_uris': 'https://example.com/', |
88 |
'home_url': 'https://example.com/', |
|
88 | 89 |
}, |
89 | 90 |
{ |
90 | 91 |
'frontchannel_logout_uri': 'https://example.com/southpark/logout/', |
... | ... | |
92 | 93 |
{ |
93 | 94 |
'frontchannel_logout_uri': 'https://example.com/southpark/logout/', |
94 | 95 |
'frontchannel_timeout': 3000, |
96 |
'text_color': '#ff00ff', |
|
95 | 97 |
}, |
96 | 98 |
{ |
97 | 99 |
'identifier_policy': OIDCClient.POLICY_PAIRWISE_REVERSIBLE, |
... | ... | |
260 | 262 |
exp_delta = (parse_timestamp(claims['exp']) - now()).total_seconds() |
261 | 263 |
assert exp_delta > 0 |
262 | 264 |
if oidc_client.idtoken_duration: |
263 |
assert abs(exp_delta - oidc_client.idtoken_duration.total_seconds()) < 2 |
|
265 |
assert ( |
|
266 |
abs(exp_delta - datetime.timedelta(seconds=int(oidc_client.idtoken_duration)).total_seconds()) < 2 |
|
267 |
) |
|
264 | 268 |
else: |
265 | 269 |
assert abs(exp_delta - 30) < 2 |
266 | 270 | |
267 |
- |