Default permissions to rw
163506
def create_result(self, local_path, container_path, permissions, meta, val, dividers):
        """"""
        if permissions is NotSpecified:
            permissions = 'rw'
        return Mount(local_path, container_path, permissions)
1038551
def rw_config(key, value, default_value = nil)
      if value.nil?
        acts_as_authentic_config.include?(key) ? acts_as_authentic_config[key] : default_value
      else
        self.acts_as_authentic_config = acts_as_authentic_config.merge(key => value)
        value
      end
    end
1351427
def revoke_access(self):
        """"""
        reading = PERMISSIONS['user']['execute'] + PERMISSIONS['group']['execute'] + PERMISSIONS['other']['execute']
        os.chmod(self.file_path, reading)
82617
def refresh_permissions(permissions):
    """"""
    available_permissions = [x.codename for x in
                             Permission.objects.filter(
                                 codename__startswith=ACL_CODE_PREFIX)]
    active_permissions = permissions.keys()

    perms_to_add = set(active_permissions) - set(available_permissions)
    perms_to_remove = set(available_permissions) - set(active_permissions)

    # Remove deprecated permissions
    for codename in perms_to_remove:
        Permission.objects.filter(codename=codename).delete()

    # Add generated permissions
    ct = ContentType.objects.get_for_model(model=auth_models.User)
    for codename in perms_to_add:
        Permission.objects.get_or_create(codename=codename,
                                         name=permissions[codename],
                                         content_type=ct)
1345371
def get_permissions_mode(permission_octal, name):
    """"""
    read = PERMISSIONS[name]['read']
    write = PERMISSIONS[name]['write']
    execute = PERMISSIONS[name]['execute']

    # Read
    if permission_octal == 4:
        return read & ~write & ~execute

    # Write
    elif permission_octal == 2:
        return ~read & write & ~execute

    # Execute
    elif permission_octal == 1:
        return ~read & ~write & execute

    # Read & Write
    elif permission_octal == 6:
        return read & write & ~execute

    # Read & Execute
    elif permission_octal == 5:
        return read & ~write & execute

    # Write & Execute
    elif permission_octal == 3:
        return ~read & write & execute

    # Read, Write & Execute
    elif permission_octal == 7:
        return read & write & execute

    # No read, write or execute by default
    else:
        return ~read & ~write & ~execute
286955
def set_user_project_permission(self, project, user, auth_role):
        
        self.remote_store.set_user_project_permission(project, user, auth_role)
1047476
def reset_permission_factories(self):
        """"""
        for key in ('read', 'create', 'update', 'delete'):
            full_key = '{0}_permission_factory'.format(key)
            if full_key in self.__dict__:
                del self.__dict__[full_key]
1091992
public void setPermission(String src, FsPermission permission
                            ) throws IOException {
    checkOpen();
    clearFileStatusCache();
    
    try {
      namenode.setPermission(src, permission);
    } catch(RemoteException re) {
      throw re.unwrapRemoteException(AccessControlException.class,
                                     FileNotFoundException.class);
    }
  }
134489
void setPermissions() {

        IndexedContainer container = (IndexedContainer)m_permissions.getContainerDataSource();
        int allowed = 0;
        int denied = 0;
        for (Object itemId : container.getItemIds()) {
            Item item = container.getItem(itemId);
            Integer value = (Integer)item.getItemProperty(PROPERTY_VALUE).getValue();
            if (((Boolean)item.getItemProperty(PROPERTY_ALLOWED).getValue()).booleanValue()) {
                allowed |= value.intValue();
            }
            if (((Boolean)item.getItemProperty(PROPERTY_DENIED).getValue()).booleanValue()) {
                denied |= value.intValue();
            }
        }
        int flags = m_entry.getFlags();

        // modify the ace flags to determine inheritance of the current ace
        if (m_inheritCheckbox.getValue().booleanValue()) {
            flags |= CmsAccessControlEntry.ACCESS_FLAGS_INHERIT;
        } else {
            flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_INHERIT;
        }

        // modify the ace flags to determine overwriting of inherited ace
        if (m_overwriteCheckbox.getValue().booleanValue()) {
            flags |= CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE;
        } else {
            flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE;
        }

        if (m_responsibleCheckbox.getValue().booleanValue()) {
            flags |= CmsAccessControlEntry.ACCESS_FLAGS_RESPONSIBLE;
        } else {
            flags &= ~CmsAccessControlEntry.ACCESS_FLAGS_RESPONSIBLE;
        }

        m_changeHandler.setPermissions(new CmsPermissionBean(m_principalType, m_principalName, allowed, denied, flags));
    }
1113611
def chmod_r(root: str, permission: int) -> None:
    
    os.chmod(root, permission)
    for dirpath, dirnames, filenames in os.walk(root):
        for d in dirnames:
            os.chmod(os.path.join(dirpath, d), permission)
        for f in filenames:
            os.chmod(os.path.join(dirpath, f), permission)
410985
def permission_for_action(self, action):
        
        return "%s.%s_%s" % (self.app_name.lower(), self.model_name.lower(), action)
1012712
public void updatePermissions() {
    final String[] accessViewerList =
        this.accessViewer.trim().split(ACCESS_LIST_SPLIT_REGEX);
    final String[] accessExecutorList =
        this.accessExecutor.trim().split(ACCESS_LIST_SPLIT_REGEX);
    final String[] accessOwnerList =
        this.accessOwner.trim().split(ACCESS_LIST_SPLIT_REGEX);
    // Prepare permission types
    final Permission admin = new Permission();
    admin.addPermission(Type.READ);
    admin.addPermission(Type.EXECUTE);
    admin.addPermission(Type.ADMIN);
    final Permission executor = new Permission();
    executor.addPermission(Type.READ);
    executor.addPermission(Type.EXECUTE);
    final Permission viewer = new Permission();
    viewer.addPermission(Type.READ);
    // Sets the permissions
    this.project.clearUserPermission();
    for (String user : accessViewerList) {
      user = user.trim();
      if (!user.isEmpty()) {
        this.project.setUserPermission(user, viewer);
      }
    }
    for (String user : accessExecutorList) {
      user = user.trim();
      if (!user.isEmpty()) {
        this.project.setUserPermission(user, executor);
      }
    }
    for (String user : accessOwnerList) {
      user = user.trim();
      if (!user.isEmpty()) {
        this.project.setUserPermission(user, admin);
      }
    }
    this.project.setUserPermission(this.reportalUser, admin);
  }
839404
protected void setPermission(FsPermission permission) {
    for (INodeHardLinkFile linkedFile : linkedFiles) {
      linkedFile.setPermission(permission, false);
    }
  }
163021
private function scanRolesAndPermissions(): void
    {
        $files = $this->helper->getConfigFilesSorted();

        if (!empty($files)) {
            foreach ($files as $filePath) {
                $config = json_decode(file_get_contents($filePath), true);

                if (is_null($config)) {
                    $this->info('Invalid json file: ' . $filePath);
                } else {
                    $packageName = Arr::get($config, 'general.packageName');

                    if (is_null($packageName)) {
                        $this->error('SKIPPING! Package must have a name! file: ' . $filePath);
                        continue;
                    }

                    if (array_key_exists('acl', $config)) {
                        $this->aclData[] = [
                            'packageName' => $packageName,
                            'acl' => Arr::get($config, 'acl'),
                        ];
                    }
                }
            }
        }
    }
436152
def permission_required_or_403(perm, *args, **kwargs):
    
    kwargs['redirect_to_login'] = False
    return permission_required(perm, *args, **kwargs)
562884
def _ensure_allow_rp(rp_pyxb):
    """"""
    if not rp_pyxb.replicationAllowed:
        rp_pyxb.replicationAllowed = True
    if not rp_pyxb.numberReplicas:
        rp_pyxb.numberReplicas = 3
1212044
def permission_manager(self, permission_manager):
        
        self.check_permissions = permission_manager

        for resource in self.resource_registry:
            if getattr(resource, 'disable_permission', None) is not True:
                for method in getattr(resource, 'methods', ('GET', 'POST', 'PATCH', 'DELETE')):
                    setattr(resource,
                            method.lower(),
                            self.has_permission()(getattr(resource, method.lower())))