Display Admin Menue Only If you are Admin

This commit is contained in:
6543 2020-04-23 18:04:32 +02:00
parent d7ef368f0b
commit 3fb063b0b1
No known key found for this signature in database
GPG Key ID: A1CA74D27FD13271
2 changed files with 3 additions and 1 deletions

View File

@ -464,6 +464,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
assert userDetails != null;
if(userDetails.getIs_admin() != null) {
tinyDb.putBoolean("userIsAdmin", userDetails.getIs_admin());
navigationView.getMenu().findItem(R.id.nav_administration).setVisible(userDetails.getIs_admin());
}
tinyDb.putString("userLogin", userDetails.getLogin());
tinyDb.putInt("userId", userDetails.getId());

View File

@ -25,7 +25,8 @@
android:title="@string/navProfile" />
<item android:id="@+id/nav_administration"
android:icon="@drawable/ic_admin"
android:title="@string/navAdministration" />
android:title="@string/navAdministration"
android:visible="false" />
</group>
<group android:checkableBehavior="single"