File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 }
3030
3131 <p style =" margin-top : 16px " >
32- Azokat a köröket adminisztálhatod, amelyiknél
33- <a href =" https://pek.sch.bme.hu" >PéK</a >-en
34- <code >körvezető</code >,
35- <code >admin</code > vagy
36- <code >PR</code >
37- címed van. Jogosultságok frissítéséhez jelentkezz ki, majd be.
32+ Azokat a köröket adminisztrálhatod, amelyiknél
33+ <a href =" https://pek.sch.bme.hu" >PéK-en </a >
34+ @foreach ( var title in Constants .TrustedPekTitles .SkipLast (2 ))
35+ {
36+ <b ><code >@title </code ></b >@: ,
37+ }
38+ <b ><code >@( Constants .TrustedPekTitles [^ 2 ]) </code ></b > vagy
39+ <b ><code >@( Constants .TrustedPekTitles [^ 1 ]) </code ></b >
40+ címed van. Ha ez nem megfelelő,
41+ <a href =" https://github.com/kir-dev/StartSCH/issues/new" >nyiss egy issue-t GitHub-on</a >.
42+ Jogosultságok frissítéséhez jelentkezz ki, majd be.
3843 </p >
3944</main >
4045
Original file line number Diff line number Diff line change 1+ using System . Collections . ObjectModel ;
2+
13namespace StartSch ;
24
35public static class Constants
@@ -6,11 +8,17 @@ public static class Constants
68 public const string CookieAuthenticationScheme = nameof ( CookieAuthenticationScheme ) ;
79 public const string StartSchUserIdClaim = "id" ;
810 public const string StartSchPageAdminClaim = "startsch/page-admin" ;
11+
12+ public static readonly ReadOnlyCollection < string > TrustedPekTitles =
13+ [
14+ "Adminisztrátor" ,
15+ "körvezető" ,
16+ "körvezető helyettes" ,
17+ "PR menedzser" ,
18+ ] ;
919
10- public static bool IsPrivilegedPekTitle ( string pekTitle )
20+ public static bool IsTrustedPekTitle ( string pekTitle )
1121 {
12- return pekTitle . RoughlyMatches ( "korvez" )
13- || pekTitle . RoughlyMatches ( "admin" )
14- || pekTitle . Contains ( "PR" ) ;
22+ return TrustedPekTitles . Contains ( pekTitle , StringComparer . InvariantCultureIgnoreCase ) ;
1523 }
1624}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public IEnumerable<GroupMembership> GetAdminMemberships()
2020 {
2121 return claimsPrincipal
2222 . GetGroupMemberships ( )
23- . Where ( g => g . Titles . Any ( Constants . IsPrivilegedPekTitle ) ) ;
23+ . Where ( g => g . Titles . Any ( Constants . IsTrustedPekTitle ) ) ;
2424 }
2525 }
2626}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public async Task OnUserInformationReceived(UserInformationReceivedContext conte
4242 . Select ( m => m . PekId )
4343 . ToList ( ) ;
4444 var administeredPekGroupIds = memberships
45- . Where ( m => m . Titles . Any ( Constants . IsPrivilegedPekTitle ) )
45+ . Where ( m => m . Titles . Any ( Constants . IsTrustedPekTitle ) )
4646 . Select ( m => m . PekId )
4747 . ToHashSet ( ) ;
4848 Dictionary < int , Page > pekGroupIdToPage = await db . Pages
You can’t perform that action at this time.
0 commit comments