-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement file adapter #16
Conversation
Signed-off-by: Jason C.H <ctrysbita@outlook.com>
Signed-off-by: Jason C.H <ctrysbita@outlook.com>
Signed-off-by: Jason C.H <ctrysbita@outlook.com>
/// | ||
/// [model] is the model. | ||
void loadPolicy(Model model); | ||
Future<void> loadPolicy(Model model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments are copied from Go and TS implementation.
Some modification was made because dart doesn't suggest comment start with function name and also tagged document for each paramenter. Especially meaningless doc like "[model] is the model".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course the documents still can be improved. I prefer to do them together with other documents (Milestone 6).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the params from the comments do more harm than good IMHO, you can refactor them into prose but I think it's better to have them until then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will try to refactor them into prose.
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import '../model/model.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to be consistent with the style used in this file and others, if you think package imports are too verbose feel free to change them into relative imports but do so in a separate PR and refactor all of the codebase so it won't be inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also: https://dart-lang.github.io/linter/lints/prefer_relative_imports.html
I'm going to change all of them in following prs XD
// Copyright 2018-2021 The Casbin Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the license on each file @hsluoyz? If so, I would suggest opening a PR exclusively for this change on all files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Opening a PR for this is good.
} | ||
|
||
@override | ||
void removeFilteredPolicy( | ||
String sec, String ptype, int fieldIndex, List<String> fieldValues) { | ||
// TODO: implement removeFilteredPolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to keep the TODO until we implement this, so we can keep track easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, these functions are not available in file adapter implementation.
See also:
} | ||
|
||
@override | ||
void removePolicy(String sec, String ptype, List<String> rule) { | ||
// TODO: implement removePolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
} | ||
|
||
@override | ||
void savePolicy(Model model) { | ||
// TODO: implement savePolicy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
This pull request implements:
Full tests will be delayed until the implementation of model.