Set the user file creation mask (umask)
183140
public static void setUMask(Configuration conf, FsPermission umask) {
    conf.set(UMASK_LABEL, String.format("%1$03o", umask.toShort()));
    conf.setInt(DEPRECATED_UMASK_LABEL, umask.toShort());
  }
344346
def _set_mask(self, mask):
        
        self.mask = mask.copy()
        if self.h5 is not None:
            if 'mask' in self.h5:
                self.h5.pop('mask')
            self.h5.create_dataset('mask', mask.shape, dtype=self.mask.dtype, data=mask, compression="gzip", shuffle=True)
277978
public FsPermission applyUMask(FsPermission umask) {
    return new FsPermission(useraction.and(umask.useraction.not()),
        groupaction.and(umask.groupaction.not()),
        otheraction.and(umask.otheraction.not()));
  }
1332681
def set_mask_from_shapefile(self, shapefile_path, cell_size):
        
        # make sure paths are absolute as the working directory changes
        shapefile_path = os.path.abspath(shapefile_path)
        # ADD MASK
        with tmp_chdir(self.project_directory):
            mask_name = '{0}.msk'.format(self.project_manager.name)
            msk_file = WatershedMaskFile(project_file=self.project_manager,
                                         session=self.db_session)

            msk_file.generateFromWatershedShapefile(shapefile_path,
                                                    cell_size=cell_size,
                                                    out_raster_path=mask_name,
                                                    load_raster_to_db=self.load_rasters_to_db)
1153811
private void  renderMask(SVG.Mask mask, SvgElement obj, Box originalObjBBox)
   {
      debug("Mask render");

      boolean      maskUnitsAreUser = (mask.maskUnitsAreUser != null && mask.maskUnitsAreUser);
      float        w, h;

      if (maskUnitsAreUser)
      {
         w = (mask.width != null) ? mask.width.floatValueX(this): originalObjBBox.width;
         h = (mask.height != null) ? mask.height.floatValueY(this): originalObjBBox.height;
         //x = (mask.x != null) ? mask.x.floatValueX(this): (float)(obj.boundingBox.minX - 0.1 * obj.boundingBox.width);
         //y = (mask.y != null) ? mask.y.floatValueY(this): (float)(obj.boundingBox.minY - 0.1 * obj.boundingBox.height);
      }
      else
      {
         // Convert objectBoundingBox space to user space
         //x = (mask.x != null) ? mask.x.floatValue(this, 1f): -0.1f;
         //y = (mask.y != null) ? mask.y.floatValue(this, 1f): -0.1f;
         w = (mask.width != null) ? mask.width.floatValue(this, 1f): 1.2f;
         h = (mask.height != null) ? mask.height.floatValue(this, 1f): 1.2f;
         //x = originalObjBBox.minX + x * originalObjBBox.width;
         //y = originalObjBBox.minY + y * originalObjBBox.height;
         w *= originalObjBBox.width;
         h *= originalObjBBox.height;
      }
      if (w == 0 || h == 0)
         return;

      // Push the state
      statePush();

      state = findInheritFromAncestorState(mask);
      // Set the style for the mask (inherits from its own ancestors, not from callee's state)
      // The 'opacity', 'filter' and 'display' properties do not apply to the 'mask' element" (sect 14.4)
      state.style.opacity = 1f;
      //state.style.filter = null;

      boolean  compositing = pushLayer();

      // Save the current transform matrix, as we need to undo the following transform straight away
      canvas.save();

      boolean  maskContentUnitsAreUser = (mask.maskContentUnitsAreUser == null || mask.maskContentUnitsAreUser);
      if (!maskContentUnitsAreUser) {
         canvas.translate(originalObjBBox.minX, originalObjBBox.minY);
         canvas.scale(originalObjBBox.width, originalObjBBox.height);
      }

      // Render the mask
      renderChildren(mask, false);

      // Restore the matrix so that, if this mask has a mask, it is not affected by the objectBoundingBox transform
      canvas.restore();

      if (compositing)
         popLayer(obj, originalObjBBox);

      // Pop the state
      statePop();
   }
618247
def set_user_dir(self):
        
        is_checked = self.custom_UseUserDirectory_checkbox.isChecked()
        if is_checked:
            # Show previous templates dir
            path = setting(
                key='defaultUserDirectory',
                default='',
                expected_type=str,
                qsettings=self.settings)
        else:
            # Set the template report dir to ''
            path = temp_dir('impacts')

        self.leUserDirectoryPath.setText(path)
        self.splitter_user_directory.setEnabled(is_checked)
1187812
function UBeaconMeshSettingsRegister()
{
  this.enabled = false;
  this.allow_non_auth_connections = false;
  this.always_connectable = false;
  this.enable_mesh_window = false;
  this.mesh_window_on_hour = 0;
  this.mesh_window_duration = 0;
}
324480
function createMaskingClip() {
            if (maskingClip) {
                svg.selectAll(`#${maskingClipId}`).remove();
            }

            if (isAnimated) {
                maskingClip = svg.select('.metadata-group')
                  .append('clipPath')
                    .attr('id', maskingClipId)
                    .attr('class', 'clip-path')
                      .append('rect')
                        .attr('width', 0)
                        .attr('height', height);

                d3Selection.select(`#${maskingClipId} rect`)
                    .transition()
                    .ease(ease)
                    .duration(clipDuration)
                    .attr('width', width);
            }
        }
569247
def make_userdir(child):
    """"""
    userdir = os.path.dirname(child)
    if not os.path.isdir(userdir):
        if os.name == 'nt':
            # Windows forbids filenames with leading dot unless
            # a trailing dot is added.
            userdir += "."
        os.mkdir(userdir, 0700)
1211403
def mask(s = "%n!%u@%h")
      s = s.gsub(/%(.)/) {
        case $1
        when "n"
          @name
        when "u"
          self.user
        when "h"
          self.host
        when "r"
          self.realname
        when "a"
          self.authname
        end
      }

      Mask.new(s)
    end
197034
def _tmpfile(self, cache_key, use):
    """"""
    with temporary_file(suffix=cache_key.id + use, root_dir=self._cache_root,
                        permissions=self._permissions) as tmpfile:
      yield tmpfile
1051118
def make_user_readable (directory):
    """"""
    for root, dirs, files in os.walk(directory, onerror=util.log_error):
        for filename in files:
            make_file_readable(os.path.join(root, filename))
        for dirname in dirs:
            make_dir_readable(os.path.join(root, dirname))
791192
def file_name
      name = ""
      name += @user.nickname
      name += "-"
      name += @organization.name.parameterize
      name += "-"
      name += token
      name + ".zip"
    end
1241154
private static void _chmod(File f, int mask) throws IOException {
        // TODO WindowsPosix actually does something here (WindowsLibC._wchmod); should we let it?
        // Anyway the existing calls already skip this method if on Windows.
        if (File.pathSeparatorChar==';')  return; // noop

        if (Util.NATIVE_CHMOD_MODE) {
            PosixAPI.jnr().chmod(f.getAbsolutePath(), mask);
        } else {
            Files.setPosixFilePermissions(fileToPath(f), Util.modeToPermissions(mask));
        }
    }
187390
def set_user_perm(obj, perm, sid):
    '''
    
    '''
    info = (
        win32security.OWNER_SECURITY_INFORMATION |
        win32security.GROUP_SECURITY_INFORMATION |
        win32security.DACL_SECURITY_INFORMATION
    )
    sd = win32security.GetUserObjectSecurity(obj, info)
    dacl = sd.GetSecurityDescriptorDacl()
    ace_cnt = dacl.GetAceCount()
    found = False
    for idx in range(0, ace_cnt):
        (aceType, aceFlags), ace_mask, ace_sid = dacl.GetAce(idx)
        ace_exists = (
            aceType == ntsecuritycon.ACCESS_ALLOWED_ACE_TYPE and
            ace_mask == perm and
            ace_sid == sid
        )
        if ace_exists:
            # If the ace already exists, do nothing
            break
    else:
        dacl.AddAccessAllowedAce(dacl.GetAclRevision(), perm, sid)
        sd.SetSecurityDescriptorDacl(1, dacl, 0)
        win32security.SetUserObjectSecurity(obj, info, sd)
303829
def create_watermark(self, target, mark, fpath, quality=QUALITY, **kwargs):
        """"""

        im = utils.watermark(target, mark, **kwargs)
        im.save(fpath, quality=quality)
        return im
1337158
def cli(env, identifier):
    """"""

    mgr = SoftLayer.UserManager(env.client)
    user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
    object_mask = "mask[id, permissions, isMasterUserFlag, roles]"

    user = mgr.get_user(user_id, object_mask)
    all_permissions = mgr.get_all_permissions()
    user_permissions = perms_to_dict(user['permissions'])

    if user['isMasterUserFlag']:
        click.secho('This account is the Master User and has all permissions enabled', fg='green')

    env.fout(roles_table(user))
    env.fout(permission_table(user_permissions, all_permissions))