Handler for ACL update/create action
779065
private function action_save()
    {
        $mbox  = trim(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true)); // UTF7-IMAP
        $user  = trim(rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST));
        $acl   = trim(rcube_utils::get_input_value('_acl', rcube_utils::INPUT_POST));
        $oldid = trim(rcube_utils::get_input_value('_old', rcube_utils::INPUT_POST));

        $acl    = array_intersect(str_split($acl), $this->rights_supported());
        $users  = $oldid ? array($user) : explode(',', $user);
        $result = 0;

        foreach ($users as $user) {
            $user   = trim($user);
            $prefix = $this->rc->config->get('acl_groups') ? $this->rc->config->get('acl_group_prefix') : '';

            if ($prefix && strpos($user, $prefix) === 0) {
                $username = $user;
            }
            else if (!empty($this->specials) && in_array($user, $this->specials)) {
                $username = $this->gettext($user);
            }
            else if (!empty($user)) {
                if (!strpos($user, '@') && ($realm = $this->get_realm())) {
                    $user .= '@' . rcube_utils::idn_to_ascii(preg_replace('/^@/', '', $realm));
                }

                // Make sure it's valid email address to prevent from "disappearing folder"
                // issue in Cyrus IMAP e.g. when the acl user identifier contains spaces inside.
                if (strpos($user, '@') && !rcube_utils::check_email($user, false)) {
                    $user = null;
                }

                $username = $user;
            }

            if (!$acl || !$user || !strlen($mbox)) {
                continue;
            }

            $user     = $this->mod_login($user);
            $username = $this->mod_login($username);

            if ($user != $_SESSION['username'] && $username != $_SESSION['username']) {
                if ($this->rc->storage->set_acl($mbox, $user, $acl)) {
                    $ret = array('id' => rcube_utils::html_identifier($user),
                         'username' => $username, 'acl' => implode($acl), 'old' => $oldid);
                    $this->rc->output->command('acl_update', $ret);
                    $result++;
                }
            }
        }

        if ($result) {
            $this->rc->output->show_message($oldid ? 'acl.updatesuccess' : 'acl.createsuccess', 'confirmation');
        }
        else {
            $this->rc->output->show_message($oldid ? 'acl.updateerror' : 'acl.createerror', 'error');
        }
    }
751436
def users_create_or_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/users/create_or_update.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
324244
def hook_action(action, repo_id):
    """"""
    github = GitHubAPI(user_id=current_user.id)
    repos = github.account.extra_data['repos']

    if repo_id not in repos:
        abort(404)

    if action == 'disable':
        if github.remove_hook(repo_id, repos[repo_id]['full_name']):
            db.session.commit()
            return redirect(url_for('.index'))
        else:
            abort(400)
    elif action == 'enable':
        if github.create_hook(repo_id, repos[repo_id]['full_name']):
            db.session.commit()
            return redirect(url_for('.index'))
        else:
            abort(400)
    else:
        abort(400)
599478
@Path("/acl/{spaceID}")
    @POST
    public Response updateSpaceACLs(@PathParam("spaceID") String spaceID,
                                    @QueryParam("storeID") String storeID) {
        String msg = "update space ACLs(" + spaceID + ", " + storeID + ")";

        try {
            log.debug(msg);
            return doUpdateSpaceACLs(spaceID, storeID);

        } catch (ResourceNotFoundException e) {
            return responseNotFound(msg, e, NOT_FOUND);

        } catch (ResourceException e) {
            return responseBad(msg, e, INTERNAL_SERVER_ERROR);

        } catch (Exception e) {
            return responseBad(msg, e, INTERNAL_SERVER_ERROR);
        }
    }
400791
def action_update(self):
        

        order = []
        form = self.request.form
        attachments = form.get("attachments", [])

        for attachment in attachments:
            # attachment is a form mapping, not a dictionary -> convert
            values = dict(attachment)

            uid = values.pop("UID")
            obj = api.get_object_by_uid(uid)

            # delete the attachment if the delete flag is true
            if values.pop("delete", False):
                self.delete_attachment(obj)
                continue

            # remember the order
            order.append(uid)

            # update the attachment with the given data
            obj.update(**values)
            obj.reindexObject()

        # set the attachments order to the annotation storage
        self.set_attachments_order(order)

        # redirect back to the default view
        return self.request.response.redirect(self.context.absolute_url())
898061
private void checkACL(String path, int perm) throws KeeperException.NoAuthException {
        DataAndVersion node = _data.get(path);
        if (node == null) {
            return;
        }
        List<ACL> acl = node.getAcl();
        if (acl == null || acl.size() == 0) {
            return;
        }
        for (Id authId : _ids) {
            if (authId.getScheme().equals("super")) {
                return;
            }
        }
        for (ACL a : acl) {
            Id id = a.getId();
            if ((a.getPerms() & perm) != 0) {
                if (id.getScheme().equals("world") && id.getId().equals("anyone")) {
                    return;
                }
                for (Id authId : _ids) {
                    if (authId.getScheme().equals(id.getScheme()) && authId.getId().equals(id.getId())) {
                        return;
                    }
                }
            }
        }
        throw new KeeperException.NoAuthException();
    }
1366003
def update
      if @user.update_attributes(permitted_params.user.merge({:password_required => false}))
        redirect_to edit_user_url(@user), :notice => t(:your_changes_were_saved)
      else
        render :action => 'edit'
      end
    end
207919
def update_authorized?(record = nil, column = nil)
      (!nested? || !nested.readonly?) && (record || self).authorized_for?(crud_type: :update, column: column, reason: true)
    end
978587
def acp_users_edit():
    """"""
    global current_user
    if not current_user.is_admin:
        return error("Not authorized to edit users.", 401)
    if not db:
        return error('The ACP is not available in single-user mode.', 500)
    data = request.form

    form = UserEditForm()
    if not form.validate():
        return error("Bad Request", 400)
    action = data['action']

    if action == 'new':
        if not data['username']:
            return error("No username to create specified.", 400)
        uid = max(int(i) for i in db.hgetall('users').values()) + 1
        pf = [False for p in PERMISSIONS]
        pf[0] = True  # active
        pf[7] = True  # must_change_password
        user = User(uid, data['username'], '', '', '', *pf)
        write_user(user)
        db.hset('users', user.username, user.uid)
        new = True
    else:
        user = get_user(data['uid'])
        new = False

    if not user:
        return error("User does not exist.", 404)

    alert = ''
    alert_status = ''

    if action == 'save':
        if data['newpwd1']:
            if data['newpwd1'] == data['newpwd2']:
                user.password = password_hash(data['newpwd1'])
            else:
                alert = 'Passwords don’t match.'
                alert_status = 'danger'
                action = 'save_fail'
        elif new:
            alert = 'Must set a password.'
            alert_status = 'danger'
            action = 'save_fail'

        if data['username'] != user.username:
            db.hdel('users', user.username)
            user.username = data['username']
            db.hset('users', user.username, user.uid)
        user.realname = data['realname']
        user.email = data['email']
        for p in PERMISSIONS:
            setattr(user, p, p in data)
        user.active = True
        if user.uid == current_user.uid:
            user.is_admin = True
            user.must_change_password = False
            current_user = user
        write_user(user)

    return render('coil_users_edit.tmpl',
                  context={'title': 'Edit user',
                           'user': user,
                           'new': new,
                           'action': action,
                           'alert': alert,
                           'alert_status': alert_status,
                           'form': form})
819954
def update_flags
      self.allow_anon = self.require_anon = self.require_admin = self.unknown_controller = self.non_standard = false

      self.unknown_controller = true
      klass = ::Incline.get_controller_class(controller_name)

      if klass
        self.unknown_controller = false
        if klass.require_admin_for?(action_name)
          self.require_admin = true
        elsif klass.require_anon_for?(action_name)
          self.require_anon = true
        elsif klass.allow_anon_for?(action_name)
          self.allow_anon = true
        end

        # if the authentication methods are overridden, set a flag to alert the user that standard security may not be honored.
        unless klass.instance_method(:valid_user?).owner == Incline::Extensions::ActionControllerBase &&
            klass.instance_method(:authorize!).owner == Incline::Extensions::ActionControllerBase
          self.non_standard = true
        end

      end

    end
529150
public function updateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(static::CONTROLLER_CHECK_RESOURCE, Dealer::getModuleCode(),
                AccessManager::UPDATE)
        ) {
            return $response;
        }

        // Load object if exist
        if (null !== $object = $this->getExistingObject()) {
            // Hydrate the form abd pass it to the parser
            $changeForm = $this->hydrateObjectForm($object);

            // Pass it to the parser
            $this->getParserContext()->addForm($changeForm);
        }

        // Render the edition template.
        return $this->getEditRenderTemplate();
    }
937188
function addAcls(app, config) {
  config.acls = config.acls || []

  return Promise.resolve(Object.keys(app.models)).mapSeries(modelName => {
    const Model = app.models[modelName]

    if (typeof Model._templates !== 'function') {
      return null
    }

    return Promise.resolve(Object.keys(Model._templates()))
      .mapSeries(templateName => {
        const fnNameRemote = `_template_${templateName}_remote`

        return Promise.resolve(config.acls).mapSeries(acl => {
          const templateAcl = Object.assign({}, acl)

          templateAcl.model = modelName
          templateAcl.property = fnNameRemote
          debug('Create ACL entry for %s.%s ', modelName, fnNameRemote)
          return app.models.ACL.create(templateAcl)
        })
      })
  })
}
1068895
function () {
            var self = this;
            var originalUpdateAction = self.options.actions.updateAction;
            self.options.actions.updateAction = function (postData) {
                return $.Deferred(function ($dfd) {

                    var input = $.extend({}, postData);

                    originalUpdateAction.method(input)
                        .done(function (result) {
                            var jtableResult = {
                                "Result": "OK",
                                originalResult: result
                            };

                            if (originalUpdateAction.returnsRecord) {
                                if (originalUpdateAction.recordField) {
                                    jtableResult.Record = result[originalUpdateAction.recordField];
                                } else {
                                    jtableResult.Record = result;
                                }
                            }

                            $dfd.resolve(jtableResult);
                        })
                        .fail(function (error) {
                            self._handlerForFailOnAbpRequest($dfd, error);
                        });
                });
            };
        }
456822
function updateWithHandler (ddoc, viewName, docName, body, callback) {
      if (typeof body === 'function') {
        callback = body
        body = undefined
      }
      return view(ddoc, viewName + '/' + encodeURIComponent(docName), {
        type: 'update',
        method: 'PUT',
        body: body
      }, callback)
    }
939064
def acts(self):
        
        if self.acls is None:
            return None
        return {p: acl * self.get_thin_interval()
                for (p, acl) in self.acls.items()}
572520
def update(value, options = {})
      raise Diplomat::IdParameterRequired unless value['ID'] || value[:ID]

      custom_params = use_cas(@options)
      @raw = send_put_request(@conn, ['/v1/acl/update'], options, value, custom_params)
      parse_body
    end
1242587
def _acl_changes(name, id=None, type=None, rules=None, consul_url=None, token=None):
    '''
       
    '''
    info = __salt__['consul.acl_info'](id=id, token=token, consul_url=consul_url)

    if info['res'] and info['data'][0]['Name'] != name:
        return True
    elif info['res'] and info['data'][0]['Rules'] != rules:
        return True
    elif info['res'] and info['data'][0]['Type'] != type:
        return True
    else:
        return False