Skip to content

Make language setting available via graph user (read & write) #5455

Closed

Description

@kulmann

Is your feature request related to a problem? Please describe.

Actually two ideas:

  1. ownCloud Web currently has quite some boilerplate code to fetch or update the current value of the language setting. Using the anyways generated graph client would reduce code complexity in ownCloud Web.
  2. the settings service currently validates the provided value on save. The language is actually something that should be defined by the respective client. At the moment the settings service holds a hardcoded list of available languages. Just having a language attribute on the user data type and being able to update that to any string would be much appreciated. That way ownCloud Web could define the available languages based on translation coverage from transifex.

Acceptance Criteria

  • We havelanguage prop in GET /me and GET /users/{user-id}
  • Clients can set Being able to set any alphanumeric value in PATCH /users/{user-id}
  • Clients can set the language during the POST request to create a user

NOTE: we removed the requirement to do any admin related read or write with the preferred language because that would be a major change to the settings service. The settings service can currently only read and write settings for the acting user.

Activity

  1. stale commented on Mar 26, 2023

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

  2. dschmidt commented on Oct 12, 2023

    @dschmidt
    Member
  3. moved this from Qualification to Backlog in Infinite Scale Team Boardon Oct 13, 2023
  4. mmattel commented on Oct 13, 2023

    @mmattel
    Contributor

    @2403905 we just discussed language a view minutes ago, maybe this one is interresting for you too.

  5. moved this from Backlog to In progress in Infinite Scale Team Boardon Nov 3, 2023
  6. moved this from In progress to Backlog in Infinite Scale Team Boardon Nov 3, 2023
  7. self-assigned this
    on Nov 6, 2023
  8. moved this from Backlog to In progress in Infinite Scale Team Boardon Nov 6, 2023
  9. butonic commented on Nov 9, 2023

    @butonic
    Contributor

    We will extend the libregraph user resuource with a preferredLanguage property, following MS graph: https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties

    Property Type Description
    preferredLanguage String The preferred language for the user. The preferred language format is based on RFC 4646. The name is a combination of an ISO 639 two-letter lowercase culture code associated with the language, and an ISO 3166 two-letter uppercase subculture code associated with the country or region. Example: "en-US", or "es-ES". Returned by default.

    Note: Clients can store en but need to be able to interpret en-US in case another client stores a region code

    To set the language to english:

    PATCH https://cloud.ocis.test/graph/v1.0/me
    Content-type: application/json
    
    {
      "preferreddLanguage": "en"
    }

    when successful will return a HTTP/1.1 204 No Content response.

  10. butonic commented on Nov 9, 2023

    @butonic
    Contributor

    To persist the language setting we have to use the settings service, as it contains the currently configured language of the user. We also cannot use the User resource of the CS3 API to store the language, as it has no language property. For the LDAP backend we could use the inetOrgPerson optional preferredLanguage attribute, but it might be readonly.

    To avoid problems with these backends we will stick to the settings service at the cost of making an additional request to the settings service (which requires a new grpc client) that can be aquired with eg.:

    	traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
    	if err != nil {
    		l.Error().Err(err).Msg("cannot initialize tracing")
    		return err
    	}
    
    	grpcClient, err := grpc.NewClient(
    		append(
    			grpc.GetClientOptions(cfg.GRPCClientTLS),
    			grpc.WithTraceProvider(traceProvider),
    		)...,
    	)
    	if err != nil {
    		l.Error().Err(err).Msg("cannot create grpc client")
    		return err
    	}
    
    	valueService := settingssvc.NewValueService("com.owncloud.api.settings", grpcClient)
  11. dragonchaser commented on Nov 16, 2023

    @dragonchaser
    Contributor

    can we close this now?

  12. removed their assignment
    on Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions