Added programmer role and fixed snackbar not showing
This commit is contained in:
@@ -31,6 +31,7 @@ final attendanceLogsProvider = StreamProvider<List<AttendanceLog>>((ref) {
|
||||
|
||||
final hasFullAccess =
|
||||
profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher' ||
|
||||
profile.role == 'it_staff';
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ final leavesProvider = StreamProvider<List<LeaveOfAbsence>>((ref) {
|
||||
|
||||
final hasFullAccess =
|
||||
profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher' ||
|
||||
profile.role == 'it_staff';
|
||||
|
||||
|
||||
@@ -16,9 +16,10 @@ final passSlipsProvider = StreamProvider<List<PassSlip>>((ref) {
|
||||
if (profile == null) return Stream.value(const <PassSlip>[]);
|
||||
|
||||
final isAdmin = profile.role == 'admin' || profile.role == 'dispatcher';
|
||||
final hasFullAccess = isAdmin || profile.role == 'programmer';
|
||||
|
||||
final wrapper = StreamRecoveryWrapper<PassSlip>(
|
||||
stream: isAdmin
|
||||
stream: hasFullAccess
|
||||
? client
|
||||
.from('pass_slips')
|
||||
.stream(primaryKey: ['id'])
|
||||
@@ -30,7 +31,7 @@ final passSlipsProvider = StreamProvider<List<PassSlip>>((ref) {
|
||||
.order('requested_at', ascending: false),
|
||||
onPollData: () async {
|
||||
final query = client.from('pass_slips').select();
|
||||
final data = isAdmin
|
||||
final data = hasFullAccess
|
||||
? await query.order('requested_at', ascending: false)
|
||||
: await query
|
||||
.eq('user_id', profile.id)
|
||||
|
||||
@@ -156,7 +156,8 @@ class ProfileController {
|
||||
final isAdminProvider = Provider<bool>((ref) {
|
||||
final profileAsync = ref.watch(currentProfileProvider);
|
||||
return profileAsync.maybeWhen(
|
||||
data: (profile) => profile?.role == 'admin',
|
||||
data: (profile) =>
|
||||
profile?.role == 'admin' || profile?.role == 'programmer',
|
||||
orElse: () => false,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -266,6 +266,7 @@ final tasksProvider = StreamProvider<List<Task>>((ref) {
|
||||
|
||||
final isGlobal =
|
||||
profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher' ||
|
||||
profile.role == 'it_staff';
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@ final ticketsProvider = StreamProvider<List<Ticket>>((ref) {
|
||||
|
||||
final isGlobal =
|
||||
profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher' ||
|
||||
profile.role == 'it_staff';
|
||||
|
||||
|
||||
@@ -101,7 +101,10 @@ final swapRequestsProvider = StreamProvider<List<SwapRequest>>((ref) {
|
||||
return Stream.value(const <SwapRequest>[]);
|
||||
}
|
||||
|
||||
final isAdmin = profile.role == 'admin' || profile.role == 'dispatcher';
|
||||
final isAdmin =
|
||||
profile.role == 'admin' ||
|
||||
profile.role == 'programmer' ||
|
||||
profile.role == 'dispatcher';
|
||||
|
||||
final wrapper = StreamRecoveryWrapper<SwapRequest>(
|
||||
stream: isAdmin
|
||||
|
||||
Reference in New Issue
Block a user