Instance Methods 
Constructs a new ParseRole with the given name and ACL.

@param {String} name The name of the Role to create.
@param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.
968354
function(name, acl) {
      if (_.isString(name) && (acl instanceof Parse.ACL)) {
        Parse.Object.prototype.constructor.call(this, null, null);
        this.setName(name);
        this.setACL(acl);
      } else {
        Parse.Object.prototype.constructor.call(this, name, acl);
      }
    }
257376
public static BoxLegalHoldPolicy.Info create(BoxAPIConnection api, String name) {
        return createOngoing(api, name, null);
    }
1031785
public function addButtonInRecordView($module, $name, $acl = 'view', $divider = false)
    {
        $parser = $this->getParser($module);
        $buttons = $this->getRecordViewButtons($parser, 'actiondropdown');

        // Search if the button exists
        foreach ($buttons as $button) {
            if ($button['name'] === strtolower($name)) {
                throw new SugarException("The button $name already exists in $module");
            }
        }

        if ($divider === true) {
            $buttons[] = array(
                'type' => 'divider',
            );
        }

        // Add the button
        $buttons[] = array(
            'type' => 'rowaction',
            'event' => 'button:' . 'btn' . ucfirst(strtolower($name)) . ':click',
            'name' => strtolower($name),
            'label' => 'LBL_' . strtoupper($name),
            'acl_action' => $acl
        );

        // Add label
        $utils = new Utils($this->entryPoint);
        $utils->addLabel($module, $GLOBALS['current_language'], 'LBL_' . strtoupper($name), $name);

        $this->setRecordViewButtons($parser, 'actiondropdown', $buttons);
    }
1359013
private function _initAcl()
    {
        $this->_acl = new \MUtil_Acl();

        if (get_class(self::$_instanceOfSelf)!=='Gems_Roles') {
            throw new \Gems_Exception_Coding("Don't use project specific roles file anymore, you can now do so by using the gems_roles tabel and setup->roles from the interface.");
        }
        // Probeer eerst uit db in te lezen met fallback als dat niet lukt
        try {
            $this->loadDbAcl();

        } catch (\Exception $e) {

            \Gems_Log::getLogger()->logError($e);

            // Reset all roles
            unset($this->_acl);
            $this->_acl = new \MUtil_Acl();

            //Voeg standaard rollen en privileges in
            $this->loadDefaultRoles();
            $this->loadDefaultPrivileges();
        }

        // Now allow 'master' all access, except for the actions that have the
        // nologin privilege (->the login action)
        if (!$this->_acl->hasRole('master')) {
            //Add role if not already present
            $this->_acl->addRole('master');
        }
        $this->_acl->allow('master');
        $this->_acl->deny('master', null, 'pr.nologin');
    }
630859
function makeSmartAccessor(name, isOption) {
  Object.defineProperty(Log.prototype, name, {
    enumerable: true,
    configurable: true,
    get: function() {
      return isOption ? this.always._options[name] : this.always['_' + name];
    },
    set: function(value) {
      if (isOption) {
        this.always._options[name] = value;
      } else {
        this.always['_' + name] = value;
      }
    },
  });
}
608979
@Override
  public Stat createOrSetWithParents(String path, String data, List<ACL> acl, CreateMode createMode)
    throws InterruptedException, KeeperException

  {
    if(exists(path) != null)
      return setData(path, data);

    try
    {
      createWithParents(path, data, acl, createMode);
      return null;
    }
    catch(KeeperException.NodeExistsException e)
    {
      // this should not happen very often (race condition)
      return setData(path, data);
    }
  }
904003
function loadRole(configPath, name) {
  return plugin.myrmex.fire('beforeRoleLoad', configPath, name)
  .spread((documentPath, name) => {
    // Because we use require() to get the config, it could either be a JSON file
    // or the content exported by a node module
    // But because require() caches the content it loads, we clone the result to avoid bugs
    // if the function is called twice
    const config = _.cloneDeep(require(configPath));
    const Role = require('./role');
    const role = new Role(config, name);

    // This event allows to inject code to alter the Lambda configuration
    return plugin.myrmex.fire('afterRoleLoad', role);
  })
  .spread((role) => {
    return Promise.resolve(role);
  });
}
1089052
def acl=(acl)
      validator = EnumAttributeValidator.new('String', ["public", "private"])
      unless validator.valid?(acl)
        fail ArgumentError, "invalid value for 'acl', must be one of #{validator.allowable_values}."
      end
      @acl = acl
    end
442630
def get(self, acl):
        
        return self._instance._client.acls.get(self._instance.name, acl)
877835
function createHam(options) {
    const dataDir = path.normalize(path.join(utils.controllerDir, require(path.join(utils.controllerDir, 'lib', 'tools.js')).getDefaultDataDir()));

    // you have to call the adapter function and pass a options object
    // name has to be set and has to be equal to adapters folder name and main file name excluding extension
    // adapter will be restarted automatically every time as the configuration changed, e.g system.adapter.template.0
    const adapter = new utils.Adapter(options);

    let homebridgeHandler;
    const attempts = {};

    // is called when adapter shuts down - callback has to be called under any circumstances!
    adapter.on('unload', callback => {
        try {
            adapter.log.info('cleaned everything up...');
            homebridgeHandler.end();
            callback();
        } catch (e) {
            callback();
        }
    });

    process.on('SIGINT', () => homebridgeHandler.end());

    process.on('SIGTERM', () => homebridgeHandler.end());

    process.on('uncaughtException', err => {
        if (adapter && adapter.log) {
            adapter.log.warn('Exception: ' + err);
        }
        homebridgeHandler.end();
    });

    // is called if a subscribed state changes
    adapter.on('stateChange', (id, state) => {
        // Warning, state can be null if it was deleted
        adapter.log.info('stateChange ' + id + ' ' + JSON.stringify(state));

        id = id.substr(adapter.namespace.length+1);
        adapter.log.debug('lookup id: ' + id);
        // you can use the ack flag to detect if it is status (true) or command (false)
        if (state && !state.ack) {
            adapter.log.debug('ack is not set!');
            homebridgeHandler.setValueForCharId(id, state.val);
        }
    });

    function updateDev(dev_id, dev_name, dev_type, dev_uuid) {
        adapter.log.info('updateDev ' + dev_id + ': name = ' + dev_name + ' /type= ' + dev_type);
        // create dev
        adapter.getObject(dev_id, (err, obj) => {
            if (!err && obj) {
                adapter.extendObject(dev_id, {
                    type: 'device',
                    common: {name: dev_name},
                    native: {
                        UUID: dev_uuid,
                        displayName: dev_name,
                        category: dev_type
                    }
                });
            }
            else {
                adapter.setObject(dev_id, {
                    type: 'device',
                    common: {name: dev_name},
                    native: {
                        UUID: dev_uuid,
                        displayName: dev_name,
                        category: dev_type
                    }
                }, {});
            }
        });
    }

    function updateChannel(dev_id, ch_id, name, ch_uuid) {
        const id = dev_id + '.' + ch_id;
        // create channel for dev
        adapter.log.info('updateChannel ' + id + ': name = ' + name);
        adapter.getObject(id, (err, obj) => {
            if (!err && obj) {
                adapter.extendObject(id, {
                    type: 'channel',
                    common: {name: name},
                    native: {
                        UUID: ch_uuid,
                        displayName: name
                    }
                });
            }
            else {
                adapter.setObject(id, {
                    type: 'channel',
                    common: {name: name},
                    native: {
                        UUID: ch_uuid,
                        displayName: name
                    }
                }, {});
            }
        });
    }

    function updateState(dev_id, ch_id, st_id, name, value, common, st_uuid, callback) {
        const id = dev_id + '.' + ch_id + '.'+ st_id;
        if (!common) common = {};
        if (common.name === undefined) common.name = name;
        if (common.role === undefined) common.role = 'state';
        if (common.read === undefined && common.write === undefined) common.read = true;
        if (common.type === undefined) common.type = 'string';
        if (common.unit === undefined) common.unit = '';

        adapter.log.info('updateState ' + id + ': value = ' + value + ' /common= ' + JSON.stringify(common));

        adapter.getObject(id, (err, obj) => {
            if (!err && obj) {
                adapter.extendObject(id, {
                    type: 'state',
                    common: common,
                    native: {
                        UUID: st_uuid,
                        displayName: name
                    }
                }, callback);
            }
            else {
                adapter.setObject(id, {
                    type: 'state',
                    common: common,
                    native: {
                        UUID: st_uuid,
                        displayName: name
                    }
                }, callback);
            }
        });
    }

    function setState(dev_id, ch_id, st_id, value) {
        const id = dev_id + '.' + ch_id + '.' + st_id;
        adapter.setState(id, value, true);
    }

    // is called when databases are connected and adapter received configuration.
    // start here!
    adapter.on('ready', main);

    function loadExistingAccessories(callback) {
        adapter.getDevices((err, res) => {
            if (err) {
                adapter.log.error('Can not get all existing devices: ' + err);
                return;
            }
            for (let i = 0; i < res.length; i++) {
                if (res[i].native && res[i].native.UUID) {
                    adapter.log.debug('Remember existing Accessory ' + res[i].native.displayName + ' with UUID ' + res[i].native.UUID);
                    homebridgeHandler.registerExistingAccessory(res[i].native.UUID, res[i].native.displayName);
                }
            }

            if (callback) callback();
        });
    }

    //Catch Homebridge Console Logging
    if (process.argv.indexOf('--logs') === -1 && process.argv.indexOf('-l') === -1) {
        console.log = function (logs) {
            if (adapter && adapter.log && adapter.log.debug) {
                adapter.log.debug(logs);
            }
            process.stdout.write(logs + '\n');
        };
    }

    function main() {
        const usedLogger = {
            info: adapter.log.debug,
            warn: adapter.log.warn,
            debug: adapter.log.silly,
            silly: adapter.log.silly
        };
        if (adapter.config.useGlobalHomebridge) {
            homebridgeHandler = require('./lib/global-handler');
            homebridgeHandler.init({
                logger: usedLogger,
                homebridgeBasePath: adapter.config.globalHomebridgeBasePath,
                homebridgeConfigPath: adapter.config.globalHomebridgeConfigPath,
                updateDev: updateDev,
                updateChannel: updateChannel,
                updateState: updateState,
                setState: setState,
                ignoreInfoAccessoryServices: adapter.config.ignoreInfoAccessoryServices,
                characteristicPollingInterval: adapter.config.characteristicPollingInterval * 1000,
                insecureAccess: adapter.config.insecureAccess || false
            });
        }
        else {
            homebridgeHandler = require('./lib/wrapper-handler');
            homebridgeHandler.init({
                logger: usedLogger,
                homebridgeConfigPath: dataDir + adapter.namespace.replace('.', '_'),
                updateDev: updateDev,
                updateChannel: updateChannel,
                updateState: updateState,
                setState: setState,
                wrapperConfig: adapter.config.wrapperConfig,
                ignoreInfoAccessoryServices: adapter.config.ignoreInfoAccessoryServices,
                characteristicPollingInterval: adapter.config.characteristicPollingInterval * 1000,
                insecureAccess: adapter.config.insecureAccess || false
            });
        }

        // in this template all states changes inside the adapters namespace are subscribed
        adapter.subscribeStates('*');

        installLibraries(() => {
            loadExistingAccessories(() => {
                homebridgeHandler.start();

                options.exitAfter && setTimeout(() => adapter && adapter.stop(), 10000);
            });
        });
    }

    function installNpm(npmLib, callback) {
        const path = __dirname;
        if (typeof npmLib === 'function') {
            callback = npmLib;
            npmLib = undefined;
        }

        const cmd = 'npm install ' + npmLib + ' --production --prefix "' + path + '"';
        adapter.log.info(cmd + ' (System call)');
        // Install node modules as system call

        // System call used for update of js-controller itself,
        // because during installation npm packet will be deleted too, but some files must be loaded even during the install process.
        const child = child_process.exec(cmd);

        child.stdout.on('data', buf => adapter.log.info(buf.toString('utf8')));
        child.stderr.on('data', buf => adapter.log.error(buf.toString('utf8')));

        child.on('exit', (code /* , signal */) => {
            if (code) {
                adapter.log.error('Cannot install ' + npmLib + ': ' + code);
            }
            // command succeeded
            if (typeof callback === 'function') callback(npmLib);
        });
    }

    function installLibraries(callback) {
        let allInstalled = true;
        if (adapter.config && adapter.config.libraries && !adapter.config.useGlobalHomebridge) {
            const libraries = adapter.config.libraries.split(/[,;\s]+/);

            for (let lib = 0; lib < libraries.length; lib++) {
                if (libraries[lib] && libraries[lib].trim()) {
                    libraries[lib] = libraries[lib].trim();
                    if (!nodeFS.existsSync(__dirname + '/node_modules/' + libraries[lib] + '/package.json')) {

                        if (!attempts[libraries[lib]]) {
                            attempts[libraries[lib]] = 1;
                        } else {
                            attempts[libraries[lib]]++;
                        }
                        if (attempts[libraries[lib]] > 3) {
                            adapter.log.error('Cannot install npm packet: ' + libraries[lib]);
                            continue;
                        }

                        installNpm(libraries[lib], () => installLibraries(callback));
                        allInstalled = false;
                        break;
                    }
                }
            }
        }
        if (allInstalled) callback();
    }

    return adapter;
}
459650
@Programmatic
    public ApplicationRole newRole(
            final String name,
            final String description) {
        ApplicationRole role = findByName(name);
        if (role == null){
            role = getApplicationRoleFactory().newApplicationRole();
            role.setName(name);
            role.setDescription(description);
            container.persist(role);
        }
        return role;
    }
233346
function (name) {
        var newName;
        if (gpf.xml.isValidName(name)) {
            return name;
        }
        // Try with a starting _
        newName = "_" + name;
        if (!gpf.xml.isValidName(newName)) {
            gpf.Error.xmlInvalidName();
        }
        return newName;
    }
621373
function _compileAtrule(name) {
    var re = new RegExp('^@' + name + '\\s*([^;]+);');
    return function() {
      var pos = position();
      var m = match(re);
      if (!m) return;
      var ret = { type: name };
      ret[name] = m[1].trim();
      return pos(ret);
    }
  }
928467
def put_object_acl(self, bucket, object_name, access_control_policy):
        
        data = access_control_policy.to_xml()
        details = self._details(
            method=b"PUT",
            url_context=self._url_context(
                bucket=bucket, object_name='%s?acl' % (object_name,),
            ),
            body=data,
        )
        query = self._query_factory(details)
        d = self._submit(query)
        d.addCallback(self._parse_acl)
        return d
839957
def parse_acl(acl_iter):
    """"""

    if isinstance(acl_iter, basestring):
        acl_iter = [acl_iter]

    for chunk in acl_iter:

        if isinstance(chunk, basestring):
            chunk = chunk.splitlines()
            chunk = [re.sub(r'#.+', '', line).strip() for line in chunk]
            chunk = filter(None, chunk)
        else:
            chunk = [chunk]

        for ace in chunk:

            # If this was provided as a string, then parse the permission set.
            # Otherwise, use it as-is, which will result in an equality test.
            if isinstance(ace, basestring):
                ace = ace.split(None, 2)
                state, predicate, permission_set = ace
                yield parse_state(state), parse_predicate(predicate), parse_permission_set(permission_set)
            else:
                state, predicate, permission_set = ace
                yield parse_state(state), parse_predicate(predicate), permission_set
371872
function enroll(name, role, readonly) {

// Enroll a name into the current function context. The role can be exception,
// function, label, parameter, or variable. We look for variable redefinition
// because it causes confusion.

        const id = name.id;

// Reserved words may not be enrolled.

        if (syntax[id] !== undefined && id !== "ignore") {
            warn("reserved_a", name);
        } else {

// Has the name been enrolled in this context?

            let earlier = functionage.context[id];
            if (earlier) {
                warn(
                    "redefinition_a_b",
                    name,
                    name.id,
                    earlier.line + fudge
                );

// Has the name been enrolled in an outer context?

            } else {
                stack.forEach(function (value) {
                    const item = value.context[id];
                    if (item !== undefined) {
                        earlier = item;
                    }
                });
                if (earlier) {
                    if (id === "ignore") {
                        if (earlier.role === "variable") {
                            warn("unexpected_a", name);
                        }
                    } else {
                        if (
                            (
                                role !== "exception"
                                || earlier.role !== "exception"
                            )
                            && role !== "parameter"
                            && role !== "function"
                        ) {
                            warn(
                                "redefinition_a_b",
                                name,
                                name.id,
                                earlier.line + fudge
                            );
                        }
                    }
                }

// Enroll it.

                functionage.context[id] = name;
                name.dead = true;
                name.function = functionage;
                name.init = false;
                name.role = role;
                name.used = 0;
                name.writable = !readonly;
            }
        }
    }
1118538
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof NamePart)){
    return new NamePart(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(NamePart.isInstance(json)){
    return json;
  }
  
  this.init(json);
}