anchor.diff:           get_password/1,
            credentials_changed/3,
            unset_credentials/1,
  -         upgrade/1,
            get_creds/2,
            is_system_provisioned/0,
            is_system_provisioned/1,
  
positive.code:     end.
  
  credentials_changed(Role, User, Password) ->
      case cluster_compat_mode:is_cluster_30() of
          true ->
              credentials_changed_30(Role, User, Password);
          false ->
              credentials_changed_old(Role, User, Password)
      end.
  
  credentials_changed_30(Role, User, Password) ->
      case ns_config:search(get_key(Role)) of
          {value, {User, {password, {Salt, Mac}}}} ->
              hash_password(Salt, Password) =/= Mac;
          _ ->
              true
      end.
  
  credentials_changed_old(admin, User, Password) ->
      case ns_config:search_prop(ns_config:latest(), rest_creds, creds, []) of
          [{U, Auth} | _] ->
              P = proplists:get_value(password, Auth, ""),
              User =/= U orelse Password =/= P;
          _ ->
              true
      end.
  
negative.code:     read_only_user_creds.
  
  set_credentials(Role, User, Password) ->
      ns_config:set(get_key(Role), {User, {password, hash_password(Password)}}).
  
  is_system_provisioned() ->
      is_system_provisioned(ns_config:latest()).
  