</access-policy>
971598
@Override
    public void writeFile(HttpAcceptSession httpSession) throws IOException {
        CharsetEncoder utf8Encoder = UTF_8.newEncoder();

        ResourceAddress localAddress = httpSession.getLocalAddress();
        URI requestURI = localAddress.getResource();
        String requestAuthority = requestURI.getAuthority();

        ConcurrentMap<String, CachedResult> cacheByAuthority = cacheByAuthorityRef.get();
        CachedResult cache = cacheByAuthority.get(requestAuthority);
        if (cache != null) {
            cache.writeFile(httpSession);
            return;
        }

        GatewayHttpOriginSecurity gatewayHttpOriginSecurity = localAddress.getOption(GATEWAY_ORIGIN_SECURITY);

        List<Map<String, Map<String, CrossSiteConstraintContext>>> listOfAcceptConstraintsByURI = gatewayHttpOriginSecurity
                .getAuthorityToSetOfAcceptConstraintsByURI();

        Integer minimumMaximumAge = null;
        IoBufferAllocatorEx<?> bufferAllocator = httpSession.getBufferAllocator();
        IoBufferEx buf = bufferAllocator.wrap(ByteBuffer.allocate(10240), FLAG_SHARED).setAutoExpander(bufferAllocator);

        buf.putString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", utf8Encoder);
        buf.putString("<access-policy>\n", utf8Encoder);
        buf.putString("<cross-domain-access>\n", utf8Encoder);

        boolean createdPolicy = false;

        HashSet<String> alreadyVisited = new HashSet<>();
        // for all the services
        for (Map<String, Map<String, CrossSiteConstraintContext>> servicesAcceptsToCrossSiteConstraints : listOfAcceptConstraintsByURI) {
            // for each accept on the service
            for (Entry<String, Map<String, CrossSiteConstraintContext>> acceptToConstraints : servicesAcceptsToCrossSiteConstraints
                    .entrySet()) {
                String acceptURI = acceptToConstraints.getKey();
                // if the accept authority matches the request athority
                if (URIUtils.getAuthority(acceptURI).equals(requestAuthority)) {
                    // for each cross site constraint on the accept
                    for (Entry<String, CrossSiteConstraintContext> urlToConstraint : acceptToConstraints
                            .getValue().entrySet()) {
                        CrossSiteConstraintContext constraint = urlToConstraint.getValue();
                        String urlOfConstraint = urlToConstraint.getKey();
                        // limit to purely cross-origin constraints, excluding same-origin constraints
                        // because Silverlight does not fetch or enforce clientaccesspolicy.xml for same-origin HTTP
                        // requests
                        if (!urlOfConstraint.equals(requestURI.toString())) {

                            Integer maximumAge = constraint.getMaximumAge();

                            if (maximumAge != null) {
                                if (minimumMaximumAge == null) {
                                    minimumMaximumAge = maximumAge;
                                } else {
                                    minimumMaximumAge = Math.min(maximumAge, minimumMaximumAge);
                                }
                            }

                            String acceptURIPath = URIUtils.getPath(acceptURI);
                            String sourceOrigin = constraint.getAllowOrigin();
                            String allowHeaders = constraint.getAllowHeaders();
                            String allowOrigin = constraint.getAllowOrigin();
                            String allowMethods = constraint.getAllowMethods();
                            String idString = String.format("%s%s%s%s%s", sourceOrigin, allowHeaders, allowOrigin,
                                    allowMethods, acceptURIPath);

                            // We can get multiple identical definitions due to the Map<URI <Map<String,
                            // DefaultCrossSiteConstraintContext>>>
                            // where we have identical maps on the inside
                            if (!alreadyVisited.contains(idString)) {
                                alreadyVisited.add(idString);

                                createdPolicy = true;
                                buf.putString("<policy>\n", utf8Encoder);

                                // Adding all the relevant headers that are submitted,
                                // by the (silverlight) client!
                                buf.putString("<allow-from http-request-headers=\"", utf8Encoder);

                                // applying the Authoization header:
                                buf.putString(HEADER_AUTHORIZATION + ",", utf8Encoder);

                                // 'X-WebSocket-Extensions' header, which is used to issue
                                // (Kaazing) WebSocket extensions
                                buf.putString(HEADER_WEBSOCKET_EXTENSIONS + ",", utf8Encoder);

                                // 'X-WebSocket-Version' header is used to identify the underlying version of the
                                // (websocket)
                                // protocol;
                                // For our emulation strategy the value looks like "wseb-1.0"
                                buf.putString(HEADER_WEBSOCKET_VERSION + ",", utf8Encoder);

                                // X-Origin header:
                                buf.putString(HEADER_X_ORIGIN + ",", utf8Encoder);

                                // X-Accept-Commands
                                buf.putString(HEADER_X_ACCEPT_COMMANDS + ",", utf8Encoder);

                                // X-Sequence-No
                                buf.putString(HEADER_X_SEQUENCE_NO + ",", utf8Encoder);

                                // original header:
                                URI sourceOriginURI = ("*".equals(sourceOrigin)) ? NULL_ORIGIN : URI.create(URLEncoder
                                        .encode(sourceOrigin, "UTF-8"));
                                String originHeader = format("X-Origin-%s", sourceOriginURI.toASCIIString());
                                buf.putString(originHeader, utf8Encoder);

                                if (allowHeaders != null) {
                                    buf.putString("," + allowHeaders, utf8Encoder);
                                }
                                buf.putString("\">\n", utf8Encoder);

                                if ("*".equals(allowOrigin)) {
                                    buf.putString("<domain uri=\"http://*\"/>\n", utf8Encoder);
                                    buf.putString("<domain uri=\"https://*\"/>\n", utf8Encoder);
                                    buf.putString("<domain uri=\"file:///\"/>\n", utf8Encoder);
                                } else {
                                    buf.putString("<domain uri=\"" + allowOrigin + "\"/>\n", utf8Encoder);
                                }
                                buf.putString("</allow-from>\n", utf8Encoder);

                                buf.putString("<grant-to>\n", utf8Encoder);
                                if (allowMethods != null) {
                                    String[] allowedMethods = allowMethods.toLowerCase().split(",");
                                    for (String allowedMethod : allowedMethods) {
                                        buf.putString("<resource path=\"/;" + allowedMethod, utf8Encoder);
                                        buf.putString(acceptURIPath, utf8Encoder);
                                        buf.putString("\" include-subpaths=\"true\"/>\n", utf8Encoder);
                                    }
                                }
                                buf.putString("</grant-to>\n", utf8Encoder);
                                buf.putString("</policy>\n", utf8Encoder);
                            }

                        }
                    }
                }
            }
        }

        buf.putString("</cross-domain-access>\n", utf8Encoder);
        buf.putString("\n", utf8Encoder);
        buf.flip();

        if (createdPolicy) {
            if (minimumMaximumAge != null) {
                httpSession.setWriteHeader(HEADER_MAX_AGE, valueOf(minimumMaximumAge));
            }
            httpSession.setWriteHeader(HEADER_CONTENT_LENGTH, valueOf(buf.remaining()));

            CachedResult candidateResult = new ValidResult(minimumMaximumAge, buf);
            CachedResult result = cacheByAuthority.putIfAbsent(requestAuthority, candidateResult);
            if (result == null) {
                result = candidateResult;
            }
            result.writeFile(httpSession);
        } else {
            cacheByAuthority.put(requestAuthority, new InvalidResult());
            httpSession.setStatus(HttpStatus.CLIENT_NOT_FOUND);
            httpSession.close(true);
        }
    }
417736
public static void endAccessContext() {
        AccessContext.clearAccessContextOnThread();
        final AccessContext accessContext = SuspendedAccessContext.getAccessContextOnThread();
        if (accessContext != null) { // resume
            AccessContext.setAccessContextOnThread(accessContext);
            SuspendedAccessContext.clearAccessContextOnThread();
        }
    }
1225157
private static String mapXmlAclsToCannedPolicy(
            AccessControlPolicy policy) throws S3Exception {
        if (!policy.owner.id.equals(FAKE_OWNER_ID)) {
            throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
        }

        boolean ownerFullControl = false;
        boolean allUsersRead = false;
        if (policy.aclList != null) {
            for (AccessControlPolicy.AccessControlList.Grant grant :
                    policy.aclList.grants) {
                if (grant.grantee.type.equals("CanonicalUser") &&
                        grant.grantee.id.equals(FAKE_OWNER_ID) &&
                        grant.permission.equals("FULL_CONTROL")) {
                    ownerFullControl = true;
                } else if (grant.grantee.type.equals("Group") &&
                        grant.grantee.uri.equals("http://acs.amazonaws.com/" +
                                "groups/global/AllUsers") &&
                        grant.permission.equals("READ")) {
                    allUsersRead = true;
                } else {
                    throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
                }
            }
        }

        if (ownerFullControl) {
            if (allUsersRead) {
                return "public-read";
            }
            return "private";
        } else {
            throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
        }
    }
612832
function access()
    {
        $data['agent'] = $_SERVER['HTTP_USER_AGENT'];
        $data['ip'] = $_SERVER['REMOTE_ADDR'];
        $data['method'] = $_SERVER['REQUEST_METHOD'];
        $data['uri'] = $_SERVER['REQUEST_URI'];
        $data['data'] = date('Y-m-d H:i:s');

        (new Model\Xlog)->setAccessData($data);
    }
532593
private static IAccessRule[] getAccessRules(IPath[] accessibleFiles, IPath[] nonAccessibleFiles) {
        final int accessibleFilesLength = accessibleFiles == null ? 0 : accessibleFiles.length;
        final int nonAccessibleFilesLength = nonAccessibleFiles == null ? 0 : nonAccessibleFiles.length;
        final int length = accessibleFilesLength + nonAccessibleFilesLength;
        if (length == 0) {
            return null;
        }
        final IAccessRule[] accessRules = new IAccessRule[length];
        if (accessibleFiles != null) {
	        for (int i = 0; i < accessibleFilesLength; i++) {
	            accessRules[i] = JavaCore.newAccessRule(accessibleFiles[i], IAccessRule.K_ACCESSIBLE);
	        }
        }
        if (nonAccessibleFiles != null) {
	        for (int i = 0; i < nonAccessibleFilesLength; i++) {
	            accessRules[accessibleFilesLength + i] = JavaCore.newAccessRule(nonAccessibleFiles[i], IAccessRule.K_NON_ACCESSIBLE);
	        }
        }
        return accessRules;
    }
994742
public static function access()
	{
		// Create the batch selector to change an access level on a selection list.
		$lines = array(
			'<label id="batch-access-lbl" for="batch-access" class="hasTip" title="' . Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL') . '::' . Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL_DESC') . '">',
			Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL'),
			'</label>',
			Access::assetgrouplist(
				'batch[assetgroup_id]', '',
				'class="inputbox"',
				array(
					'title' => Lang::txt('JLIB_HTML_BATCH_NOCHANGE'),
					'id'    => 'batch-access'
				)
			)
		);

		return implode("\n", $lines);
	}
1161937
@Override
	public long blocksAccessed() {
		return Index.searchCost(ii.indexType(), new SearchKeyType(schema(), ii.fieldNames()),
				tp.recordsOutput(), recordsOutput()) + recordsOutput();
	}
407065
def do_denyaccess(self, line):
        """"""
        subject, = self._split_args(line, 1, 0)
        self._command_processor.get_session().get_access_control().remove_allowed_subject(
            subject
        )
        self._print_info_if_verbose(
            'Removed subject "{}" from access policy'.format(subject)
        )
23526
public void add(Group group, AccessLevel accessLevel) {
        getAccessList().add(new Access(group, accessLevel));
    }
1081291
private void checkSuperUser() throws AccessControlException {
    // collects user and groups
    String user = AuthenticatedClientUser.getClientUser(ServerConfiguration.global());
    List<String> groups = getGroups(user);
    if (!isPrivilegedUser(user, groups)) {
      throw new AccessControlException(ExceptionMessage.PERMISSION_DENIED
          .getMessage(user + " is not a super user or in super group"));
    }
  }
1200119
def access(config, region, accounts=()):
    """"""
    config = validate.callback(config)
    accounts_report = []

    def check_access(account):
        accounts_report.append(account)
        session = get_session(account['role'], region)
        identity = session.client('sts').get_caller_identity()
        account['account_id'] = identity['Account']
        account.pop('groups')
        account.pop('role')
        client = session.client('iam')
        policy_arn = identity['Arn']
        if policy_arn.count('/') > 1:
            policy_arn = policy_arn.rsplit('/', 1)[0]
        if ':sts:' in policy_arn:
            policy_arn = policy_arn.replace(':sts', ':iam')
        if ':assumed-role' in policy_arn:
            policy_arn = policy_arn.replace(':assumed-role', ':role')
        evaluation = client.simulate_principal_policy(
            PolicySourceArn=policy_arn,
            ActionNames=['logs:CreateExportTask'])['EvaluationResults']
        account['access'] = evaluation[0]['EvalDecision']

    with ThreadPoolExecutor(max_workers=16) as w:
        futures = {}
        for account in config.get('accounts', ()):
            if accounts and account['name'] not in accounts:
                continue
            futures[w.submit(check_access, account)] = None
        for f in as_completed(futures):
            pass
    accounts_report.sort(key=operator.itemgetter('access'), reverse=True)
    print(tabulate(accounts_report, headers='keys'))
386824
public void setAccesskey(java.lang.String accesskey) {
        getStateHelper().put(PropertyKeys.accesskey, accesskey);
        handleAttribute("accesskey", accesskey);
    }
432942
public java.lang.String getAccesskey() {
        return (java.lang.String) getStateHelper().eval(PropertyKeys.accesskey);

    }
1167549
def do_clearaccess(self, line):
        """"""
        self._split_args(line, 0, 0)
        self._command_processor.get_session().get_access_control().clear()
        self._print_info_if_verbose("Removed all subjects from access policy")
69106
boolean checkAccessTopicFromControllers(UserContext ctx, String topic, Iterable<JsTopicAccessController> accessControls) throws IllegalAccessException {
		logger.debug("Looking for accessController for topic '{}' : '{}'", topic, accessControls);
		boolean tacPresent = false;
		if (null != accessControls) {
			for (JsTopicAccessController accessControl : accessControls) {
				accessControl.checkAccess(ctx, topic);
				tacPresent = true;
			}
		}
		return tacPresent;
	}
380499
@Override
    protected boolean checkAccess(CommandContext ctx) {
        for(AccessRequirement req : requirements) {
            if(req.isSatisfied(ctx)) {
                return true;
            }
        }
        return false;
    }
1140626
function addAccessControl () {
    // no access control if accessIdName not set
    if (!defined(this.args.accessIdName)) {
        return
    }
    // access id column is on primary table/record
    var alias = this.alias
    // validate column name - throw error
    var column = this.model.columnName(this.args.accessIdName, true)
    // get quoted column name
    column = this.quoteName(column)
    // get param name for value placeholder
    var paramName = this.newParam(this.args.accessIdName)
    // set value for param placeholder
    this.params[paramName] = this.args.accessId
    // add UNHEX for binary ids
    var placeholder = this.unhexId(`:${paramName}`)
    // add where SQL
    this.where.push(`${alias}.${column} = ${placeholder}`)   
}