Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/adapter/file_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
fs::File as file,
io::prelude::*,
io::{
BufReader as ioBufReader, Error as ioError, ErrorKind as ioErrorKind,

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (ubuntu-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (ubuntu-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (ubuntu-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (ubuntu-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (macos-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (macos-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (macos-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (macos-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (windows-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (windows-latest, stable)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (windows-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`

Check warning on line 14 in src/adapter/file_adapter.rs

View workflow job for this annotation

GitHub Actions / Auto Build CI (windows-latest, beta)

unused imports: `Error as ioError` and `ErrorKind as ioErrorKind`
},
path::Path as ioPath,
prelude::*,
Expand Down Expand Up @@ -147,20 +147,25 @@

for (ptype, ast) in ast_map {
for rule in ast.get_policy() {
writeln!(policies, "{}, {}", ptype, rule.join(","))
writeln!(policies, "{}, {}", ptype, rule.join(", "))
.map_err(|e| AdapterError(e.into()))?;
}
}

if let Some(ast_map) = m.get_model().get("g") {
for (ptype, ast) in ast_map {
for rule in ast.get_policy() {
writeln!(policies, "{}, {}", ptype, rule.join(","))
writeln!(policies, "{}, {}", ptype, rule.join(", "))
.map_err(|e| AdapterError(e.into()))?;
}
}
}

// Remove trailing newline to match the original file format
if policies.ends_with('\n') {
policies.pop();
}

self.save_policy_file(policies).await?;
Ok(())
}
Expand Down
Loading