Org admins may not update organisation_id or service_type
346186
def can_update(self, user, **kwargs):
        """"""
        if user.is_admin():
            raise Return((True, set([])))

        is_creator = self.created_by == user.id
        if not (user.is_org_admin(self.organisation_id) or is_creator):
            raise Return((False, set([])))

        fields = ({'service_type', 'organisation_id'} & set(kwargs.keys()))
        if fields:
            raise Return((False, fields))
        else:
            raise Return((True, set([])))
236688
public boolean update(DbSession dbSession, RuleUpdate update, OrganizationDto organization, UserSession userSession) {
    if (update.isEmpty()) {
      return false;
    }

    RuleDto rule = getRuleDto(update);
    // validate only the changes, not all the rule fields
    apply(update, rule, userSession);
    update(dbSession, rule);
    updateParameters(dbSession, organization, update, rule);
    ruleIndexer.commitAndIndex(dbSession, rule.getId(), organization);

    return true;
  }
56695
public void update(String ou, I_CmsOuTreeType type, CmsUUID groupID) {

        update(ou, type, groupID, m_filterTable.getValue());

    }
675341
def sync(self):
        
        LOGGER.debug("OSType.sync")
        params = None
        if self.id is not None:
            params = {'id': self.id}
        elif self.name is not None:
            params = {'name': self.name}

        if params is not None:
            args = {'http_operation': 'GET', 'operation_path': 'get', 'parameters': params}
            response = OSTypeService.requester.call(args)
            if response.rc != 0:
                LOGGER.warning(
                    'OSType.sync - Problem while syncing OS type (name:' + self.name + ', id: ' + str(self.id) +
                    '). Reason: ' + str(response.response_content) + '-' + str(response.error_message) +
                    " (" + str(response.rc) + ")"
                )
            else:
                json_obj = response.response_content
                self.id = json_obj['osTypeID']
                self.name = json_obj['osTypeName']
                self.architecture = json_obj['osTypeArchitecture']
                if json_obj['osTypeCompanyID'] == -1:
                    self.company_id = None
                else:
                    self.company_id = json_obj['osTypeCompanyID']
                self.osi_ids = json_obj['osTypeOSInstancesID']
772623
def organizations_create_or_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/organizations/create_or_update.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
1300456
def update(
            self, request, pk=None, parent_lookup_seedteam=None,
            parent_lookup_seedteam__organization=None):
        ''''''
        user = get_object_or_404(User, pk=pk)
        team = self.check_team_permissions(
            request, parent_lookup_seedteam,
            parent_lookup_seedteam__organization)
        team.users.add(user)
        return Response(status=status.HTTP_204_NO_CONTENT)
730341
def update(access_key, resource_policy, is_admin, is_active,  rate_limit):
    '''
    
    '''
    with Session() as session:
        try:
            data = session.KeyPair.update(
                access_key,
                is_active=is_active,
                is_admin=is_admin,
                resource_policy=resource_policy,
                rate_limit=rate_limit)
        except Exception as e:
            print_error(e)
            sys.exit(1)
        if not data['ok']:
            print_fail('KeyPair creation has failed: {0}'.format(data['msg']))
            sys.exit(1)
        print('Key pair is updated: ' + access_key + '.')
663428
public void ipOrganisation_organisationId_DELETE(String organisationId) throws IOException {
		String qPath = "/me/ipOrganisation/{organisationId}";
		StringBuilder sb = path(qPath, organisationId);
		exec(qPath, "DELETE", sb.toString(), null);
	}
206077
public void ipOrganisation_organisationId_PUT(String organisationId, OvhIpv4Org body) throws IOException {
		String qPath = "/me/ipOrganisation/{organisationId}";
		StringBuilder sb = path(qPath, organisationId);
		exec(qPath, "PUT", sb.toString(), body);
	}
25839
def cli(ctx, group, organism_name, administrate=False, write=False, read=False, export=False):
    
    return ctx.gi.groups.update_organism_permissions(group, organism_name, administrate=administrate, write=write, read=read, export=export)
260173
def update_project(self, org_name, part_name, dci_id=UNKNOWN_DCI_ID,
                       service_node_ip=UNKNOWN_SRVN_NODE_IP,
                       vrf_prof=None, desc=None):
        
        desc = desc or org_name
        res = self._create_or_update_partition(org_name, part_name, desc,
                                               dci_id=dci_id,
                                               service_node_ip=service_node_ip,
                                               vrf_prof=vrf_prof,
                                               operation='PUT')
        if res and res.status_code in self._resp_ok:
            LOG.debug("Update %s partition in DCNM.", part_name)
        else:
            LOG.error("Failed to update %(part)s partition in DCNM."
                      "Response: %(res)s", {'part': part_name, 'res': res})
            raise dexc.DfaClientRequestFailed(reason=res)
309015
public function refreshAllowedOrganizations()
    {
        // Privilege overrules organizational settings
        if ($this->hasPrivilege('pr.organization-switch')) {
            $orgs = $this->util->getDbLookup()->getOrganizations();
        } else {
            $org = $this->getBaseOrganization();

            $orgs = array($org->getId() => $org->getName()) +
                    $org->getAllowedOrganizations();
        }
        // \MUtil_Echo::track($orgs);

        $this->_setVar('__allowedOrgs', $orgs);

        // Clean this cache
        $this->_unsetVar('__allowedRespOrgs');

        return $this;
    }
1360411
def update_subscription(request, ident):
    ""
    
    try:
        subscription = Subscription.objects.get(ident=ident)
    except Subscription.DoesNotExist:
        return respond('overseer/invalid_subscription_token.html', {}, request)

    if request.POST:
        form = UpdateSubscriptionForm(request.POST, instance=subscription)
        if form.is_valid():
            if form.cleaned_data['unsubscribe']:
                subscription.delete()
        
                return respond('overseer/unsubscribe_confirmed.html', {
                    'email': subscription.email,
                })
            else:
                form.save()

            return HttpResponseRedirect(request.get_full_path())
    else:
        form = UpdateSubscriptionForm(instance=subscription)
        
    context = csrf(request)
    context.update({
        'form': form,
        'subscription': subscription,
        'service_list': Service.objects.all(),
    })

    return respond('overseer/update_subscription.html', context, request)
22708
def update_org_invite(cls, module):
        
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field("invited_by")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "invited_by",
                models.ForeignKey(
                    USER_MODEL,
                    related_name="%(app_label)s_%(class)s_sent_invitations",
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field("invitee")
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "invitee",
                models.ForeignKey(
                    USER_MODEL,
                    null=True,
                    blank=True,
                    related_name="%(app_label)s_%(class)s_invitations",
                    on_delete=models.CASCADE,
                ),
            )
        try:
            cls.module_registry[module]["OrgInviteModel"]._meta.get_field(
                "organization"
            )
        except FieldDoesNotExist:
            cls.module_registry[module]["OrgInviteModel"].add_to_class(
                "organization",
                models.ForeignKey(
                    cls.module_registry[module]["OrgModel"],
                    related_name="organization_invites",
                    on_delete=models.CASCADE,
                ),
            )
651211
def edit_service(self, id_, **kwargs):
        
        data = self._wrap_dict("service", kwargs)
        return self.patch("/services/{}.json".format(id_), data=data)
796670
def update_org_smarthost(self, orgid, serverid, data):
        """"""
        return self.api_call(
            ENDPOINTS['orgsmarthosts']['update'],
            dict(orgid=orgid, serverid=serverid),
            body=data)
543620
@Override
    @Transactional
    public ServiceManagementRecord updateServiceManagementRecord(ServiceManagementRecord serviceManagementRecord) {
        requireNotDisposed();
        requireArgument(serviceManagementRecord != null, "Cannot update a null sub system.");

        EntityManager em = emf.get();
        ServiceManagementRecord result = ServiceManagementRecord.updateServiceManagementRecord(em, serviceManagementRecord);

        em.flush();
        _logger.debug("Updated service management record {}.", result);
        _auditService.createAudit("Updated service management record : {0}", result, result);
        return result;
    }