Skip to content

Commit

Permalink
fix: Add imports and batchFileAdapter implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
divy9881 committed May 24, 2020
1 parent 7179b17 commit 3804c3d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/persist/batchFileAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { FileAdapter } from './fileAdapter';
import { BatchAdapter } from './batchAdapter';

/**
* FileAdapter is the file adapter for Casbin.
* It can load policy from file or save policy to file.
*/
export class BatchFileAdapter extends FileAdapter implements BatchAdapter {
/**
* FileAdapter is the constructor for FileAdapter.
* @param {string} filePath filePath the path of the policy file.
*/
constructor(filePath: string) {
super(filePath);
}

// addPolicies adds policy rules to the storage.
// This is part of the Auto-Save feature.
public async addPolicies(sec: string, ptype: string, rules: string[][]): Promise<void> {
throw new Error('not implemented');
}

// removePolicies removes policy rules from the storage.
// This is part of the Auto-Save feature.
public async removePolicies(sec: string, ptype: string, rules: string[][]): Promise<void> {
throw new Error('not implemented');
}
}
2 changes: 2 additions & 0 deletions src/persist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export * from './helper';
export * from './watcher';
export * from './filteredAdapter';
export * from './defaultFilteredAdapter';
export * from './batchAdapter';
export * from './batchFileAdapter';

0 comments on commit 3804c3d

Please sign in to comment.