Skip to content
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

perf: add face acl failed msg #1613

Merged
merged 1 commit into from
Dec 18, 2024
Merged

perf: add face acl failed msg #1613

merged 1 commit into from
Dec 18, 2024

Conversation

fit2bot
Copy link
Contributor

@fit2bot fit2bot commented Dec 18, 2024

perf: add face acl failed msg

@fit2bot fit2bot requested a review from a team December 18, 2024 02:34
@@ -244,6 +244,9 @@ func (u *UserSelectHandler) proxyAsset(asset model.PermAsset) {
}
tokenInfo = reviewHandler.tokenInfo
default:
msg := lang.T("Unknown error code: %s, detail: %s")
utils.IgnoreErrWriteString(u.h.term, fmt.Sprintf(msg, tokenInfo.Code, tokenInfo.Detail))
utils.IgnoreErrWriteString(u.h.term, utils.CharNewLine)
logger.Errorf("Create connect token and auth info failed: %s %s", tokenInfo.Code, tokenInfo.Detail)
return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not contain any known issues or improvements. However, it could be more streamlined by using a single return statement after checking the case for all types of assets. Also, consider if adding a comment at default case provides additional help to someone reading this function, such that they can understand what will happen when no specific case matches. Here is an example:

func (u *UserSelectHandler) proxyAsset(asset model.PermAsset) {
	if aclCheckType(u, &asset) && !hasTokenError(&tokenInfo) {

This change should improve readability and maintainability without altering functionality.

Let me know if you have another question!

ACLFaceVerify = "acl_face_verify"
ACLFaceVerify = "acl_face_verify"
ACLFaceOnline = "acl_face_online"
ACLFaceOnlineNotSupported = "acl_face_online_not_supported"
)

type ConnectOptions struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code provided appears to be related to an open-source project and is used for connecting various authentication types with specific functions and operations. The first difference I noticed is that the ACLRejected function has been renamed to AclReject. This change suggests there may have been confusion about what each of these values actually represents.

For instance, the documentation indicates two different ways to authenticate user identities:

const ACLReview = "acl_review";
const ACLReject = "acl_reject";

// User reviews an identity based on information from external services
ACLReview();

// User denies a request for approval through a security mechanism such as an ID Verification tool 

In contrast, you're referring to:

_ACLFaceVerify               = "acl_face_verify"  
_ACLFaceOnline             = "acl_face_online"
_ACLFaceOnlineNotSupported = "acl_face_online_not_supported"

// A client facing API which can only perform face identification tasks.
_ACLFaceIdentify = "face_auth_identi..."
// An external service which performs face verification tasks (e.g., Google's Image Matching Service).
_ACLFaceVerification  ...
// A service which authenticates users' access given their faces, allowing non-biometric methods like photo IDs etc.
_ACLFaceAuth                = ...

 // Performs authentication via Face Online, without checking if it supports it
_ACLFaceOnline                  = ""
_ACLFaceOnlineNotSuppor...     -- Not supported

// Represents an operation where no further action was taken due to missing support or other factors at this time
_ACLFaceOnlineNotSuport...
// For a service which doesn't handle authentication by default but still requires support of its own algorithms or logic
_ACLFaceUnsupportedService   = ""
// For a feature not implemented yet
_ACLFeatureUnimplemented      =

This could indicate some sort of miscommunication between authors or maintainers when naming these interfaces/authentications.
I recommend revisiting the design rationale and possibly creating separate interfaces/functions for different aspects rather than conflating everything under one name. For example, ACLFaceVerified, ACLFaceOffline, ACLFaceAuthorized, ACLFaceUnsupported would clearly specify the state of each operation more accurately.
It should help avoid ambiguity and ensure clear, understandable usage.

@LeeEirc LeeEirc merged commit 2f8f00d into dev Dec 18, 2024
7 checks passed
@LeeEirc LeeEirc deleted the pr@dev@perf_face_acl branch December 18, 2024 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants