Class ::nsmcp::Authorizer (public)

 ::nx::Class ::nsmcp::Authorizer[i]

Defined in /usr/local/ns/tcl/nsmcp/security.tcl

Testcases:
No testcase defined.
Source code:
    :public method allowed {context permission} {
        #
        # Check a permission against the request's grants and target servers.
        #
        # Require both the named permission and membership of the selected server in
        # the credential targets.
        #
        # @param context Authenticated request context carrying the principal,
        #        grants and selected server.
        # @param permission Permission name required by the requested operation.
        #
        # @return True when both checks pass, otherwise false.
        #

        return [expr {$permission in [$context permissions] &&
                      [$context server] in [$context targets]}]
    }

    :public method require {context permission} {
        #
        # Require a permission for the current request context.
        #
        # Reuse allowed and raise the standard RPC authorization error when access
        # is denied.
        #
        # @param context Authenticated request context carrying the principal,
        #        grants and selected server.
        # @param permission Permission name required by the requested operation.
        #
        # @return An empty result on success; an RPC error on denial.
        #

        if {![:allowed $context $permission]} {
            return -code error -errorcode {NSMCP RPC -32602} "Operation not permitted"
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: